Before we diveinto

default database <- system-wide feault, language defaults, app-specific defaults NSUserDefaults.standardUserDefaults() -> shared defaults object

key, value
“address” -> “P. Sherman, 42 Wallaby Way, Sydney”

NSUserDefaults.standardUserDefaults().valueForKey(key:String)

stringForKey(key:String), boolForKey(key:String), floatForKey(key:String)

NSUserDefaults.standardUserDefaults().setValue(AnyObject?, key:”keyString”)

import UIKit
import Foundation

class ViewController: UIViewController {
	@IBOutlet var mainView: UIView!
	@IBOutlet weak var midnightThemeLabel: UILabel!
	@IBOutlet weak var themeSwitch: UISwitch!
	@IBOutlet weak var titleLabel: UILabel!
	@IBOutlet weak var imageView: UIImageView!

	override func viewDidLoad(){
		super.viewDidLoad()
		if let weWantMidnight = NSUserDefaults.standardUserDefaults().valueForKey("midnightThemeOn") {
			if weWantMidnight as Bool {
				switchToMidnight()
				print("we lik midnight")
			} else {
				print("we like daylight")
			}
		} else {
		NSUserDefaults.standardUserDefaults().setValue(false, forKey:"midnightThemeOn")
		print("This is the first launch ever!")
		}
	}
}