Skip to content

Instantly share code, notes, and snippets.

@tenpaiyomi
Created August 10, 2015 19:34
Show Gist options
  • Save tenpaiyomi/6ee82098c0a478888c7c to your computer and use it in GitHub Desktop.
Save tenpaiyomi/6ee82098c0a478888c7c to your computer and use it in GitHub Desktop.
func whateverMethodThisIs() {
let defaults = NSUserDefaults.standardUserDefaults()
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
if !defaults.boolForKey("hasDisplayedIntroduction") {
self.window?.rootViewController = mainStoryboard.instantiateViewControllerWithIdentifier("IntroductionViewController") as! IntroductionViewController
} else {
self.window?.rootViewController = mainStoryboard.instantiateViewControllerWithIdentifier("SecondViewController") as! SecondViewController
}
self.window?.makeKeyAndVisible()
}
@IBAction func button(sender: AnyObject) {
let defaults = NSUserDefaults.standardUserDefaults()
defaults.setBool(true, forKey: "hasDisplayedIntroduction")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment