Releases: sindresorhus/Defaults
Releases · sindresorhus/Defaults
v5.0.0
Breaking
- Please read the migration guide.
- Removed
NSSecureCodingKey
andNSSecureCodingOptionalKey
.- You can now just use
Key
instead.
- You can now just use
- Dropped support for Carthage and CocoaPods.
- If you use either of these, you can still use Swift Package Manager just for this package.
Improvements
- Added support for more built-in Swift types.
- Improved the stored representation of many types.
- For example,
Array
is now stored as a native UserDefaults array instead of being stored as a JSON stringified string. Same withSet
andDictionary
.
- For example,
- Enums no longer need to be
Codable
. (Existing usage requires migration) - Added support for storing
NSColor
andUIColor
. - Added
Defaults.Toggle
.
Meta
Huge thanks to @hank121314 for doing a lot of the work on this release.
v5.0.0-beta.1
Please help us try out this beta release. And let us know if something in the migration guide could be improved.
Breaking
- Please read the migration guide.
- Removed
NSSecureCodingKey
andNSSecureCodingOptionalKey
.- You can now just use
Key
instead.
- You can now just use
- Dropped support for Carthage and CocoaPods.
- If you use either of these, you can still use Swift Package Manager just for this package.
Improvements
- Added support for more built-in Swift types.
- Improved the stored representation of many types.
- For example,
Array
is now stored as a native UserDefaults array instead of being stored as a JSON stringified string. Same withSet
andDictionary
.
- For example,
- Enums no longer need to be
Codable
. (Existing usage requires migration) - Added support for storing
NSColor
andUIColor
. - Added
Defaults.Toggle
.
v4.2.2
v4.2.1
v4.2.0
v4.1.0
v4.0.0
Important
If you use Swift Package Manager, you need to set the build setting “Other Linker Flags” to -weak_framework Combine
to work around this Xcode bug.
Breaking
- Get rid of
Defaults.OptionalKey
b2fdee2- Migrate:
extension Defaults.Keys {
- static let name = OptionalKey<Double>("name")
+ static let name = Key<Double?>("name")
}
- Remove the
.old
and.new
options forDefaults.observe
8376ca7- They're now the default. There was no good reason to not specify them and it was easy to leave them out by accident and then getting the incorrect
.newValue
/.oldValue
.
- They're now the default. There was no good reason to not specify them and it was easy to leave them out by accident and then getting the incorrect
- Rename
DefaultsObservation
toDefaults.Observation
31b56ce
Improvements
- Add
@Default
property wrapper for SwiftUI 12a65c0 - Add Combine publishers 6029ac7
.reset()
now actually removes the item instead of just setting its value tonil
.
Fixes
Defaults.reset()
now works with keys of different types, but it's limited to 10 keys because of Swift generics limitations 15c096d
v3.1.1
v3.1.0
- Add
DefaultsObsevation.tieToLifetime(of:)
54f970b - Add support for NSSecureCoding 89d2d4d