I\'m using Swift to make a game. I want to save the users high score using NSUserDefaults. I know how to create a new NSUserDefaults variable in my AppDelegate file:
Swift 4
Set Value
UserDefaults.standard.set("TEST", forKey: "Key") //setString
UserDefaults.standard.set("TEST", forKey: "Key")
Retrieve
UserDefaults.standard.string(forKey: "Key") //getString
UserDefaults.standard.string(forKey: "Key")
Remove
UserDefaults.standard.removeObject(forKey: "Key")