UserDefaults
class UserDefaults : NSObject
-
Mechanica
Returns
trueifkeyexists.Declaration
Swift
public final func hasKey(_ key: String) -> Bool -
Mechanica
Declaration
Swift
public final func optionalBool(forKey defaultName: String) -> Bool?Parameters
defaultNameA key in the current user’s defaults database.
Return Value
The bool value associated with the specified key. If the specified key does not exist, this method returns nil.
-
Mechanica
Declaration
Swift
public final func optionalDouble(forKey defaultName: String) -> Double?Parameters
defaultNameA key in the current user’s defaults database.
Return Value
The double value associated with the specified key. If the specified key does not exist, this method returns nil.
-
Mechanica
Declaration
Swift
public final func optionalFloat(forKey defaultName: String) -> Float?Parameters
defaultNameA key in the current user’s defaults database.
Return Value
The floating-point value associated with the specified key. If the key does not exist, this method returns nil.
-
Mechanica
Declaration
Swift
public final func optionalInteger(forKey defaultName: String) -> Int?Parameters
defaultNameA key in the current user’s defaults database.
Return Value
The integer value associated with the specified key. If the specified key does not exist, this method returns nil.
-
Mechanica
Removes all keys and values from user defaults.
Note
This method only removes keys on the receiverUserDefaultsobject. System-defined keys will still be present afterwards.resetStandardUserDefaultssimply resets the in-memory user defaults object.Declaration
Swift
public final func removeAll()
UserDefaults Extension Reference