data(forKey:)
Returns the data object associated with the specified key.
Declaration
func data(forKey defaultName: String) -> Data?Parameters
- defaultName:
The key to retrieve from the defaults database.
Return Value
The data object associated with defaultName, or nil if the key isn’t present in the defaults database. This method also returns nil if the retrieved value isn’t a data object.
Discussion
The returned object is immutable, even if you originally set the key to a mutable value.