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
NSUserDefaults.standardUserDefaults().setObject(Bool(false), forKey:"onoroff")
var onoroff = NSUserDefaults.standardUserDefaults().objectForKey("onoroff") as Bool!
if (onoroff != nil && onoroff == false)
{
}
EDIT:
NSUserDefaults.standardUserDefaults().setBool(false, forKey: "onoroff")
if NSUserDefaults.standardUserDefaults().boolForKey("onoroff"){
}else{
}