sindresorhus / Defaults

💾 Swifty and modern UserDefaults
https://swiftpackageindex.com/sindresorhus/Defaults/documentation/defaults
MIT License
1.97k stars 117 forks source link

Support `ClosedRange` and `Range` #98

Closed sindresorhus closed 2 years ago

sindresorhus commented 2 years ago

I think they should just serialize into an array with two elements: .lowerBound and .upperBound.

@hank121314 Thoughts?

hank121314 commented 2 years ago

Yes! swift also only encode these two elements. I think we might also support any Bound that conforms to Defaults.Serializable?

Reference: https://github.com/apple/swift/blob/223d73cc470d2395b3d55d07eaf6866e7f6171f9/stdlib/public/core/ClosedRange.swift#L495-L501

sindresorhus commented 2 years ago

I think we might also support any Bound that conforms to Defaults.Serializable?

👍