Defaults Set and get value for Boolean Type in Swift 3
User defaults are used to store the data with key values inside of the app memory and get that in entire app classes.You can store by key value and also access by key value.
Defaults set value using Below code
Defaults Get value using Below code
Defaults set value using Below code
let defaults = UserDefaults.standard
defaults.set(true, forKey: "Key")
defaults.synchronize()
let value = defaults.value(forKey: "isInitial") as! Bool
Comments
Post a Comment