Swift Userdefaults Enum

[Solved] Swift Userdefaults Enum | Swift - Code Explorer | yomemimo.com
Question : swift userdefaults enum

Answered by : cedric

UserDefaults.standard.set(switchCurrentType.rawValue, forKey: "CurrentDefaultType")

Source : https://stackoverflow.com/questions/45441946/how-do-i-save-an-enum-case-value-to-userdefaults-for-further-usage/45548405 | Last Update : Wed, 17 Jun 20

Question : swift userdefaults enum

Answered by : cedric

//in the didMoveToView method put this code in
switchCurrentType = ExampleEnum(rawValue: UserDefaults.standard.integer(forKey: "CurrentDefaultType"))! //make sure exclamation mark at the end is there or it won't read properly

Source : https://stackoverflow.com/questions/45441946/how-do-i-save-an-enum-case-value-to-userdefaults-for-further-usage/45548405 | Last Update : Wed, 17 Jun 20

Answers related to swift userdefaults enum

Code Explorer Popular Question For Swift