Reputation: 5
I'm making an app and want to save the value of UISwitch either on or off to be saved in notifications center but I don't understand how to save the value of it
any solution will be appericated
Upvotes: -1
Views: 56
Reputation: 95
if you want to store your data ( on or off status ) you can use userdefaults.
You can set data by doing this:
UserDefaults.standard.set(value: yourData forKey: "yourKey")
To retrieve the data
let myData = UserDefaults.standard.value(forKey: "yourKey")
Upvotes: 0