To interact with the system default is used NSUserDefaults class. The defaults system allows an application to customize its behavior to match a user’s preferences. For example, you can allow users to determine what units of measurement your application displays or how often documents are automatically saved. Applications record such preferences by assigning values ​​to a set of parameters in a user’s defaults database.
At runtime, you use an NSUserDefaults object to read the defaults that your application uses from a user’s defaults database.
The synchronize () method, which is automatically invoked at periodic intervals, keeps the in-memory cache in sync with a user’s defaults database.
The NSUserDefaults class provides convenience methods for accessing common types such as floats, doubles, integers, Booleans, and URLs. A default object must be a property list-that is, an instance of (or for collections, a combination of instances of): NSData, NSString, NSNumber, NSDate, NSArray, or NSDictionary. If you want to store any other type of object, you should typically archive it to create an instance of NSData. For more details, see Preferences and Settings Programming Guide.

Swift programming

Tutorial language Swift