Setting default value in NSUserDefaults ios8 using swift
How to enable google toggle?
Also I read that if the user launches the app for the first time, the default will not be used. How can I check this?
In a set of settings
In application settings
In AppDelegate
let defaults:NSUserDefaults = NSUserDefaults.standardUserDefaults();
let showEnabledString:Bool = defaults.boolForKey("enabled_string");
println(showEnabledString); // true
let appDefaults: NSDictionary = NSDictionary(object: "YES", forKey: "enabled_string");
// This code also does not change the appearance in the settings app
NSUserDefaults.standardUserDefaults().registerDefaults(appDefaults as [NSObject : AnyObject]);
NSUserDefaults.standardUserDefaults().synchronize();
+3
source to share
1 answer