Returns the string associated with the specified key.
SDKs
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Foundation
Declaration
Parameters
defaultNameA key in the current user‘s defaults database.
Return Value
For string values, the string associated with the specified key; for number values, the string value of the number. Returns nil if the default does not exist or is not a string or number value.
Discussion
The returned string is immutable, even if the value you originally set was a mutable string.