Saving Data with User Defaults

When you work with features like Login, Upvote and Commenting, you might want to make some data persistent, especially when the API doesn’t include that. With User Defaults, you can store that data on your phone. The application will remember the Login and Upvotes the next time it launches.

let userDefaults = NSUserDefaults.standardUserDefaults()
userDefaults.setObject(token, forKey: "tokenKey")