5.0.0-beta.1
Pre-release
Pre-release
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 theDefaults
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 ofDefaults[.yourKey]
. In case you are not using Swift 5.1, you would need to transition toDefaults[\.yourKey]
instead ofDefaults[.yourKey]
. @marty-suzuki - 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
DefaultsBridge
is now a struct, not a class. You need to use composition instead of inheritance to compose them. @Z-JaDeDefaultsBridge
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