Swift - How to set initial value for NSUserDefaults
问题 I have a switch called soundSwitch, I am saving the state of the button using an user default as such: @IBAction func soundsChanged(sender: AnyObject) { if soundSwitch.on{ defaults.setBool(true, forKey: "SoundActive") print("Sound ON") }else{ defaults.setBool(false, forKey: "SoundActive") print("Sound OFF") } } Currently the actual defaults value is initially false when the user first launches the application. How do I implement the defaults to be true if the user is first launching the app