Skip to content

Releases: sindresorhus/Defaults

v5.0.0

01 Jun 10:58
63d93f9
Compare
Choose a tag to compare

Breaking

  • Please read the migration guide.
  • Removed NSSecureCodingKey and NSSecureCodingOptionalKey.
    • You can now just use Key instead.
  • 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 with Set and Dictionary.
  • Enums no longer need to be Codable. (Existing usage requires migration)
  • Added support for storing NSColor and UIColor.
  • Added Defaults.Toggle.

Meta

Huge thanks to @hank121314 for doing a lot of the work on this release.


v4.2.2...v5.0.0

v5.0.0-beta.1

18 May 13:00
63d93f9
Compare
Choose a tag to compare
v5.0.0-beta.1 Pre-release
Pre-release

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 and NSSecureCodingOptionalKey.
    • You can now just use Key instead.
  • 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 with Set and Dictionary.
  • Enums no longer need to be Codable. (Existing usage requires migration)
  • Added support for storing NSColor and UIColor.
  • Added Defaults.Toggle.

v4.2.2...v5.0.0-beta.1

v4.2.2

18 Apr 16:49
Compare
Choose a tag to compare
  • Fix crash in .publisher() caused by immediately cancelling subscriber (#66) 6158b9b

v4.2.1...v4.2.2

v4.2.1

26 Feb 10:31
Compare
Choose a tag to compare
  • Fix regression in 4.2.0 regarding availability annotations c956886

v4.2.0

20 Feb 13:32
Compare
Choose a tag to compare
  • Support .removeDuplicates() for Defaults.publisher (#60) 760dbfb

v4.1.0

28 Aug 21:46
Compare
Choose a tag to compare
  • Add ability to subscribe to multiple keys ab81276
  • Add ability to prevent event propagation ab81276

v4.0.0...v4.1.0

v4.0.0

18 Apr 07:51
Compare
Choose a tag to compare

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 for Defaults.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.
  • Rename DefaultsObservation to Defaults.Observation 31b56ce

Improvements

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...v4.0.0

v3.1.1

30 Oct 12:49
Compare
Choose a tag to compare
  • Fix availability checks for CocoaPods a82d672

v3.1.0

30 Oct 12:11
Compare
Choose a tag to compare

v3.0.0

11 Sep 08:07
Compare
Choose a tag to compare

Breaking

  • Require Xcode 11 and Swift 5.1 for building 90ac6f8
  • Switch from defaults to Defaults 90ac6f8
    Example: defaults[.unicorn]Defaults[.unicorn]
    Example: defaults.observableDefaults.observable
  • Rename defaults.clear to Defaults.removeAll and make it a static method 27c9997

Enhancements

  • Add .reset() method to reset the given keys back to their default value d1e4215