I am struggling to figure out how to do an if statement with a bool saved to NSUserDefaults using Swift. I believe I know how to save the bool to NSUserDefaults but a confirmati
To check bool value instead of objectForKey we must use boolForKey. I find that as a mistakes in the answer you accepted
if (NSUserDefaults.standardUserDefaults().boolForKey("onoroff")){
NSUserDefaults.standardUserDefaults().setBool(true, forKey: "onoroff")
}else
{
NSUserDefaults.standardUserDefaults().setBool(false, forKey: "onoroff")
}