Skip to content

morishin/BetterUserDefaults

Repository files navigation

BetterUserDefaults

Swift version CocoaPods compatible Carthage compatible

UserDefaults Swift Extensions

Usage

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

Installation

Carthage

Cartfile

github "morishin/BetterUserDefaults"

CocoaPods

Podfile

pod 'BetterUserDefaults'

LICENSE

MIT