I\'m trying to create a game with Swift, and I want to add the ability to create a username, which will be saved in NSUserDefaults. This is my code:
println(&
In Swift 4.1 UserDefaults.standard.set(textfield.text, forKey: "yourKey") // saves text field text UserDefaults.standard.synchronize() // To Retrieve textfield.text = UserDefaults.standard.value(forKey:"yourKey") as? String