NSUserDefaults - Swift
NSUserDefaults is a class that allows simple storage of different data types. It is ideal for small bits of information you need to persist between app launches or device restarts. NSUserDefaults supports the following data types: NSString NSNumber NSDate NSArray NSDictionary NSData NSUserDefaults should be used to store small amounts of data. Here is simple use of NSUserDefaults to save the user name so that the next time they open up the app, I don’t have to ask them again. In this case, it would be overkill for me to store this type of data in Core Data or other complex mechanism. I simply check NSUserDefaults for a value and go from there. It is important to remember that NSUserDefaults are just that, helpful for reading/writing user preferences and other similar things. Saving data: Before we read or write data from NSUserDefaults, we must first get a reference to the NSUserDefaults class. ...