Check out example codes for "swift userdefaults enum". It will help you in understanding the concepts better.

Code Example 1

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

Code Example 2

//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

Learn ReactJs, React Native from akashmittal.com