SwiftyUserDefaults v5.0.0-beta.1 Release Notes

Release Date: 2019-09-05 // almost 3 years ago
  • 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

    • 0️⃣ Introduced DefaultsAdapter thats the main object for user defaults and the Defaults global variable. @marty-suzuki
    • 0️⃣ Thanks to DefaultsAdapter, if you are using Swift 5.1 you can use dyanmic member lookup! This allows you to use
      0️⃣ 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
    • 0️⃣ 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
    • 0️⃣ DefaultsBridge is now a struct, not a class. You need to use composition instead of inheritance to compose them. @Z-JaDe
    • 0️⃣ 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