Skip to content

5.0.0-beta.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@sunshinejr sunshinejr released this 06 Sep 15:17
· 107 commits to master since this release

This cool release prepares for Swift 5.1 - we introduce key path access (enabling dynamicMemberLookup) and property wrapper! Additionally there are some changes to all Defaults global variable, DefaultsKeys and `DefaultsBridge - check out our migration guide for more.

Changelog

  • Introduced DefaultsAdapter thats the main object for user defaults and the Defaults global variable. @marty-suzuki
  • Thanks to DefaultsAdapter, if you are using Swift 5.1 you can use dyanmic member lookup! This allows you to use
    Defaults.yourKey instead of Defaults[.yourKey]. In case you are not using Swift 5.1, you would need to transition to Defaults[\.yourKey] instead of Defaults[.yourKey]. @marty-suzuki
  • There is a new protocol, DefaultsKeyStore that DefaultsKeys conform to. This key store is then accepted by the DefaultsAdapter so you can have multiple key stores for multiple adapters! @marty-suzuki
  • Unfortunately the above means that you need to declare your keys as a computed properties instead of static stored ones.@marty-suzuki
  • DefaultsBridge is now a struct, not a class. You need to use composition instead of inheritance to compose them. @Z-JaDe
  • DefaultsBridge changed a little bit, there is no isSerialized property anymore, if you create your own bridge you need to provide deserialize() method as well. @Z-JaDe
  • Added @SwiftyUserDefault property wrapper for Swift 5.1 users! It uses key paths and has options to cache/observe your defaults as well. @sunshinejr
  • Updated project to recommended settings of Xcode 10.2. @philippec-ls