Skip to content

Releases: orchetect/swift-prefs

2.0.0

Choose a tag to compare

@orchetect orchetect released this 28 Nov 07:47

Note

The repository has been renamed from PrefsKit to swift-prefs.

Please migrate your dependencies to use the new repository URL and module import name. See the README for more details.

1.3.7

Choose a tag to compare

@orchetect orchetect released this 14 Sep 00:59

Maintenance

  • Now uses latest major version of swift-syntax dependency where possible, maintaining backwards compatibility
  • Reworked package and imports to remove spurious compiler dependency warnings
  • Updated GitHub CI for recent changes in action runners

1.3.6

Choose a tag to compare

@orchetect orchetect released this 29 Aug 21:29

New

  • Added support for @PrefsSchema class declaration to be bound to @MainActor (requires Swift 6.2 / Xcode 26)

Improved

  • Better support for Xcode 26

1.3.5

Choose a tag to compare

@orchetect orchetect released this 03 Apr 16:44

Fixed

  • Fixed unit test build issues with Xcode 16.3

1.3.4

Choose a tag to compare

@orchetect orchetect released this 23 Feb 05:00

Fixed

  • Fixed regression where inline coding using the @Pref(encode:decode:) macro sometimes prevented building

1.3.3

Choose a tag to compare

@orchetect orchetect released this 22 Feb 10:01

Fixed

  • Fixed bug where accessing defaulted pref could result in an exception

1.3.2

Choose a tag to compare

@orchetect orchetect released this 16 Jan 05:14

New

  • Added CodableArrayPrefsCoding. Usage:
    @Pref(coding: [MyCodableType].jsonDataArrayPrefsCoding)
    var foo: [MyCodableType]?
    
    @Pref(coding: [MyCodableType].jsonStringArrayPrefsCoding)
    var foo: [MyCodableType]?
  • Added CodableDictionaryPrefsCoding. Usage:
    @Pref(coding: [String: MyCodableType].jsonDataDictionaryPrefsCoding)
    var foo: [String: MyCodableType]?
    
    @Pref(coding: [String: MyCodableType].jsonStringDictionaryPrefsCoding)
    var foo: [String: MyCodableType]?
  • Added RawRepresentableArrayPrefsCoding. Usage:
    @Pref(coding: [MyRawType].rawRepresentableArrayPrefsCoding)
    var foo: [MyRawType]?
  • Added RawRepresentableDictionaryPrefsCoding. Usage:
    @Pref(coding: [String: MyRawType].rawRepresentableDictionaryPrefsCoding)
    var foo: [String: MyRawType]?

Maintenance

  • Updated README
  • Added unit tests

1.3.1

Choose a tag to compare

@orchetect orchetect released this 11 Jan 03:19

New

  • Added new @RawPref pref macro for [Any] and [String: Any] preference value types
  • PrefsStorage: Added setUnsafeStorageValue(forKey: String, to: Any?) method
  • PrefsStorage: Changed storageValue(forKey:) methods returning [Any]? and [String: Any]? to a single method returning Any?

See updated README for more details.

1.3.0

Choose a tag to compare

@orchetect orchetect released this 10 Jan 23:32

PrefsKit 1.3.0

Note

PrefsKit 1.3.0 is a major update and brings substantial new features and robustness to existing features.

Note that this version brings some breaking changes since 1.2.x.

Tip

See the updated README.md for documentation on the new features.

New

  • Prefs storage backends capabilities have been expanded (#9) to allow:
    • initializing from plist, JSON, or custom serialization formats
    • importing content from plist, JSON, or custom serialization formats, replacing or merging with existing storage contents
    • exporting the storage as plist, JSON, or custom serialization formats
  • Date is added as an atomic type.
    Its default encoding uses the ISO8601 format that NSDate encodes for plists. This allows cross-compatibility between UserDefaults and plist files. (Custom coding can still be provided as before to override the encoding format.)

Changed

  • This release involves a substantial overhaul of how arrays and dictionaries are handled. (#8)
    • Arrays and dictionaries with a homogenous value type (ie: [Int], [String], [String: Int], [String: String]) remain directly usable in @Pref type declarations with less internal overhead now
    • Arrays and dictionaries with mixed value types ([Any] or [String: Any]) are no longer usable directly with @Pref type declarations, and the type-erasure boxes AnyPrefsArray and AnyPrefsDictionary have been removed from the library. Handling of mixed collections is now the responsibility of the user. See the updated README for more details.

1.2.0

Choose a tag to compare

@orchetect orchetect released this 02 Jan 07:49

New

  • Added new built-in coding strategies (#3)
    • Bool stored as Int (1/0)
    • Bool stored as String (true/false, yes/no, or custom strings)
    • Data: stored as Base-64 String
    • Data compression
    • Date stored as ISO-8601 String
    • BinaryInteger stored as Int
    • FixedWidthInteger stored as String
    • URL stored as absolute URL string
  • Pref declarations using a RawRepresentable type can now access .rawRepresentablePrefsCoding static property as an alternative to using @RawRepresentablePref. This allows chaining additional strategies.
    @Pref(coding: MyType.rawRepresentablePrefsCoding) var foo: MyType?
  • Pref declarations using a Codable type can now access .jsonDataPrefsCoding or .jsonStringPrefsCoding static properties as an alternative to using @JSONDataCodablePref or @JSONStringCodablePref. This allows chaining additional strategies.
    @Pref(coding: MyType.jsonDataPrefsCoding) var foo: MyType?
  • Coding strategies can now be composed by chaining two or more strategies (#5)
    @Pref(coding: MyType
        .jsonDataPrefsCoding
        .base64DataString()
    ) var foo: MyType?

Maintenance

  • Updated README documentation