To store variables into the app for later use, this are the commands:
eg:
variablename which is the .setObject interested the values stored inside the variable.
stringNameTobeSaved which is the key name to be save into file.
To load the value from file back into variable, this is the command:
eg:
NSUserDefaults.standardUserDefaults().setObject(variablename, forKey: "stringNameTobeSaved")
eg:
NSUserDefaults.standardUserDefaults().setObject(toDoList, forKey: "toDoList")
variablename which is the .setObject interested the values stored inside the variable.
stringNameTobeSaved which is the key name to be save into file.
To load the value from file back into variable, this is the command:
variablename = NSUserDefaults.standardUserDefaults().objectForKey("stringNameTobeSaved") as! [String]
eg:
toDoList = NSUserDefaults.standardUserDefaults().objectForKey("toDoList") as! [String][string] here is and array.