I\'m trying to save a bool value to UserDefaults from a UISwitch, and retrieve it in another view. However, I\'ve tried following multiple tutorials and stack answe
Use this line of code:
@IBAction func soundSwitch(_ sender: UISwitch) { UserDefaults.standard.set(soundSwitchOutlet.isOn, forKey: "sound") }
insteadof :
@IBAction func soundSwitch(_ sender: UISwitch) { UserDefaults.standard.set(soundSwitchOutlet, forKey: "sound") }