SwiftyUserDefaults v5.0.0-beta.1 Release Notes
Release Date: 2019-09-05 // over 4 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 allDefaults
global variable,DefaultsKeys
and `DefaultsBridge - check out our migration guide for more.🔄 Changelog
- 0️⃣ Introduced
DefaultsAdapter
thats the main object for user defaults and theDefaults
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 ofDefaults[.yourKey]
. In case you are not using Swift 5.1, you would need to transition toDefaults[\.yourKey]
instead ofDefaults[.yourKey]
. @marty-suzuki - 0️⃣ There is a new protocol,
DefaultsKeyStore
thatDefaultsKeys
conform to. This key store is then accepted by theDefaultsAdapter
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 noisSerialized
property anymore, if you create your own bridge you need to providedeserialize()
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
- 0️⃣ Introduced