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
Try this:
@IBAction func soundSwitchs(_ sender: Any) { UserDefaults.standard.set(soundSwitchOutlet.isOn, forKey: "sound") UserDefaults.standard.synchronize() } //this is inside viewDidLoad and "boolValue" was declared outside viewDidLoad// boolValue = UserDefaults.standard.bool(forKey: "sound")