SwiftyUserDefaults

Modern Swift API for NSUserDefaults

MIT License

Stars
4.8K
Committers
42
SwiftyUserDefaults - 5.3.0 Latest Release

Published by sunshinejr over 3 years ago

Changelog

  • Renamed OptionalType.empty to OptionalType.__swifty_empty. Also removed the OptionalType.wrapped since it wasn't used in the framework anymore. Please note that this still shouldn't be something you rely on tho, we're gonna explore ways to remove the public OptionalType in a future releases. @sunshinejr
SwiftyUserDefaults - 5.2.0

Published by sunshinejr over 3 years ago

Changelog

  • DefaultsAdapter's subscript setters are now nonmutating. This shouldn't change much on the client side, but it does fix the issue with simultaneous access (#241, #247). @sunshinejr
  • Added DefaultsProviding protocol that DefaultsAdapter implements. It should help with DI and creating test adapters (#268). @sunshinejr
SwiftyUserDefaults - 5.1.0

Published by sunshinejr over 3 years ago

This version only increases the minimum requirements for iOS to make it compatible with Xcode 12. Redone since we didn't bump podspec version for CocoaPods support.

SwiftyUserDefaults - 5.0.0

Published by sunshinejr almost 5 years ago

Finally version 5.0.0 is ready to go! After extensive testing we are releasing this version to the public. 🚀

Very warm thank you to everyone participating in all these months of work: @marty-suzuki, @Z-JaDe, @philippec-ls and others that contributed to this project. On to the next year! 🥂

Note: There shouldn't be any differences between latest beta and this version so you should be ready to go with bumping the version in your favorite dependency manager. If you are migrating from version 4 and lower, please check our migration guides.

SwiftyUserDefaults - 5.0.0-beta.5

Published by sunshinejr about 5 years ago

Unfortunately we had to remove Combine for now to keep Xcode 10 compatibility 😭 You might want to update to that version ASAP as it's fixing crashes on release builds...

Changelog

  • Removed Combine extensions for now. Due to problems with weak-linking the framework, it's too difficult to support it with ease using all package managers and also without breaking backwards-compatibility. Probably gonna introduce it once we only support Xcode 11. @sunshinejr
SwiftyUserDefaults - 5.0.0-beta.4

Published by sunshinejr about 5 years ago

Fixed a pretty bad indexing/building issue... See Migration Guide for more.

Changelog

  • Fixed an issue with Xcode freezing, never-finishing indexing/building the project when we used Defaults[\.keyPath] in conditional statement. Unfortunately we had to add key label to Defaults[key: DefaultsKey<String?>...] where you wouldn't have to add the label to the subscript before. @sunshinejr.
SwiftyUserDefaults - 5.0.0-beta.3

Published by sunshinejr about 5 years ago

Fixes to package managers! 🚀 Xcode 11 & Carthage are friends again. Also, you won't fetch testing libraries for SPM anymore so you can use your Xcode Previews again.

Changelog

  • Fixed an issue with SPM integration - it no longer fetches testing libraries & doesn't create runtime crashes or Xcode Preview crashes anymore. @sunshinejr.
  • Fixed an issue where Carthage users using Xcode 11 couldn't install SwiftyUserDefaults 5. We added weak-linking for the xcodeproj so you might need additional steps for Xcode 10 + Carthage + SwiftyUserDefaults 5.* users. @sunshinejr.
SwiftyUserDefaults - 5.0.0-beta.2

Published by sunshinejr about 5 years ago

This beta adds Combine support! Just use it on the DefaultsAdapter (if you can use Combine):

func obserColorScheme() {
    colorSchemeObserver = Defaults.publisher(for: \.colorSchemeObserver)
        .sink { value in
            //
        }
}
SwiftyUserDefaults - 5.0.0-beta.1

Published by sunshinejr about 5 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

  • 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
SwiftyUserDefaults - 4.0.0

Published by sunshinejr over 5 years ago

4.0.0 is finally out. A lot of cool features and improvements for you to try today! 🚀

Changes from 4.0.0-beta.2 to 4.0.0

  • Updated DefaultsKey.defaultValue access level to public. @DivineDominion
  • Updated access level of all bridges to open from public. @fredpi

Read migration guide from version 3.x to 4.x

SwiftyUserDefaults - 4.0.0-beta.2

Published by sunshinejr over 5 years ago

Minor stability update for Carthage users. This should fix the linking problem we've had in beta.1.
No other fixes/updates were introduced in here.

SwiftyUserDefaults - 4.0.0-beta.1

Published by sunshinejr over 5 years ago

This update introduces few cool additions to the library! 🎉

Changelog

  • Added support for launch arguments/plist for Bool, Double, Int, String values. @sunshinejr
  • Added support for KVO! DivineDominion, toshi0383, @sunshinejr
  • Brought back dictionary support for [String: Any]/[String: String] and corresponding array version of it [[String: Any]]/[[String: String]]. @sunshinejr

If you have already created a custom bridge for you type, and you want to use it with KVO, you'll need to override two new functions: isSerialized() and deserialize(_:). See Readme for more instructions.

SwiftyUserDefaults - 4.0.0-alpha.3

Published by sunshinejr over 5 years ago

This is a small update over 4.0.0-alpha.2 with two fixes.

Migration guide from 3.x to 4.x
Migration guide from 4.0.0-alpha.1 to 4.0.0-alpha.2

Changelog

SwiftyUserDefaults - 4.0.0-alpha.2

Published by sunshinejr over 5 years ago

🎉🎉🎉

We're back with alpha 2!

Migration guide from 3.x to 4.x
Migration guide from 4.0.0-alpha.1 to 4.0.0-alpha.2

Changelog

  • Swift 4.2 support. @sunshinejr
  • Early Swift 5.0 support! @sunshinejr
  • Rewritten core. We use DefaultsBridges now to define getters/setters for given type. @sunshinejr
  • Fixed a bug where you couldn't extend non-final class like NSColor. @sunshinejr
  • Removed type-based default values. This means you need to use key-based defaultValue or use an optional DefaultsKey from now on. @sunshinejr
  • Improved CI infra: Swift 4.1/4.2/5.0 builds with CocoaPods/Carthage/SPM integration scripts. @sunshinejr
SwiftyUserDefaults - 4.0.0-alpha.1

Published by sunshinejr over 6 years ago

🎉🎉🎉

This is a huge release. Please try it out and let me know how it feels as we still have time for improvements!

Migration guide from 3.x to 4.x

Changelog

  • Swift 4.1 support @sunshinejr
  • Added Codable support! @sunshinejr
  • Added generic subscripts support (better DefaultsKey init diagnostics and accessing Defaults[.key]) @sunshinejr
  • Added default values protocols (DefaultsDefaultValueType, DefaultsDefaultArrayValueType) - this means that you can extend any type with default value so you can create non-optional DefaultsKey afterwards! @sunshinejr
  • Added default values in DefaultsKey, e.g. DefaultsKey<String>("test", defaultValue: "default value") @sunshinejr
  • Added better support for custom types: using DefaultsSerializable, when your type implements NSCoding, RawRepresentable (enums as well) or Codable, you get default implementations for free! @sunshinejr
  • Added automatic array support for any type that is available to SwiftyUserDefaults (means custom with DefaultsSerializable as well!) @sunshinejr
  • Added Swift Package Manager support! @sunshinejr
  • Added [URL] built-in support! @sunshinejr
  • A lot of infrastructure changes (CI, project), around 350 tests to make sure all of the changes work properly! @sunshinejr
  • Removed legacy strings based API (Defaults["test"]), Dictionary and Any support (sorry, with all the changes in the library we had to, but you probably can bring it back with DefaultsSerializable anyways 😅) @sunshinejr
Package Rankings
Top 9.27% on Carthage
Top 6.49% on Swiftpackageindex.com
Badges
Extracted from project README
CocoaPods compatible Carthage compatible SPM compatible
Related Projects