All Versions
10
Latest Version
Avg Release Cycle
62 days
Latest Release
152 days ago

Changelog History

  • v3.1.1

    October 30, 2019
    • 🛠 Fix availability checks for CocoaPods a82d672
  • v3.1.0

    October 30, 2019
  • v3.0.0

    September 11, 2019

    💥 Breaking

    • 🏗 Require Xcode 11 and Swift 5.1 for building 90ac6f8
    • 0️⃣ Switch from defaults to Defaults 90ac6f8
      0️⃣ Example: defaults[.unicorn]Defaults[.unicorn]
      0️⃣ Example: defaults.observableDefaults.observable
    • 🚚 Rename defaults.clear to Defaults.removeAll and make it a static method 27c9997

    ✨ Enhancements

    • ➕ Add .reset() method to reset the given keys back to their default value d1e4215
  • v2.0.2

    July 25, 2019
    • 🛠 Fix the source file location for SwiftPM 674fde4
  • v2.0.1

    July 08, 2019
    • 🛠 Fix Swift 5 upgrade warning 865a4b0
  • v2.0.0

    April 05, 2019
    • ⬆️ Upgrade to and require Swift 5. 908d3b4
  • v1.0.0

    October 17, 2018

    Key observation

    You can now observe changes to keys in a strongly-typed fashion. It even preserves the type of the oldValue and newValue keys in the change event.

    extension Defaults.Keys { static let isUnicornMode = Key\<Bool\>("isUnicornMode", default: false) }let observer = defaults.observe(.isUnicornMode) { change in// Initial eventprint(change.oldValue) //=\> falseprint(change.newValue) //=\> false// First actual eventprint(change.oldValue) //=\> falseprint(change.newValue) //=\> true} defaults[.isUnicornMode] = true
    

    Shorter syntax

     extension Defaults.Keys {- static let quality = Defaults.Key\<Double\>("quality", default: 0.8)+ static let quality = Key\<Double\>("quality", default: 0.8) }
    

    👌 Support for alternative UserDefaults suites

    let extensionDefaults = UserDefaults(suiteName: "com.unicorn.app")!extension Defaults.Keys { static let isUnicorn = Key\<Bool\>("isUnicorn", default: true, suite: extensionDefaults) } defaults[.isUnicorn]//=\> true// OrextensionDefaults[.isUnicorn]//=\> true
    

    0️⃣ Registers default values with the native UserDefaults

    When you use, for example:

    extension Defaults.Keys { static let quality = Key\<Double\>("quality", default: 0.8) }
    

    🏗 It will register 0.8 as the default value with UserDefaults, which can then be used in other contexts, like binding in Interface Builder.

  • v0.2.2

    June 19, 2018
  • v0.2.1

    May 14, 2018
  • v0.2.0

    April 16, 2018