Nergezeev Alik
Nergezeev Alik

Reputation: 5

UISwitch in notifications center

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

Answers (1)

argus7
argus7

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

Related Questions