I created a settings bundle with about 8 toggle switches. What I am trying to do it get the default values from the settings bundle. Currently right now I have these two methods:
func registerSettingsBundle(){
let appDefaults = [String:AnyObject]()
UserDefaults.standard.register(defaults: appDefaults)
UserDefaults.standard.synchronize()
}
func updateDisplayFromDefaults(){
let defaults = UserDefaults.standard
let update_lot = defaults.bool(forKey: "update_lot")
print(update_lot)
}
and I am calling these methods in my viewDidLoad
override func viewDidLoad() {
super.viewDidLoad()
registerSettingsBundle()
updateDisplayFromDefaults()
}
However this does not get me the default values (which are all true, but they all return false). This works and gives me the correct values if I close down the app, open settings, adjust the settings and re-open the app. Is there away of getting the default settings? I went the route of reading the plist, but if I change the settings in my settings bundle, it would not take effect.