sindresorhus / Defaults

💾 Swifty and modern UserDefaults
https://swiftpackageindex.com/sindresorhus/Defaults/documentation/defaults
MIT License
1.97k stars 117 forks source link

Add support to not use `Codable` #82

Closed hank121314 closed 2 years ago

hank121314 commented 2 years ago

Summary

This PR fixed: #79. I have added a usingCodable property to Defaults.Key. If users set usingCodable to false, so the serialization will not use Codable.

Usage

private enum Foo: Int, CaseIterable, Codable, Defaults.Serializable {
    case zero
    case one
}

let key = Defaults.Key<Foo>(keyName, default: fixture, usingCodable: false)
hank121314 commented 2 years ago

Close this since we find a better solution https://github.com/sindresorhus/Defaults/issues/79#issuecomment-926688704.