UserDefaults Swift Extensions
import BetterUserDefaults
extension UserDefaults.Key {
static let sampleKeyA = UserDefaults.Key("sampleKeyA")
static let sampleKeyB = UserDefaults.Key("sampleKeyB")
}
UserDefaults.standard.set(true, for: .sampleKeyA)
UserDefaults.standard.set(123, for: .sampleKeyB)
UserDefaults.standard.bool(for: .sampleKeyA) // true
UserDefaults.standard.integer(for: .sampleKeyB) // 123
Cartfile
github "morishin/BetterUserDefaults"
Podfile
pod 'BetterUserDefaults'
MIT