Skip to content

Instantly share code, notes, and snippets.

@TheCodedSelf
Last active January 23, 2016 10:22
Show Gist options
  • Save TheCodedSelf/6b7b1bf262109cd3341e to your computer and use it in GitHub Desktop.
Save TheCodedSelf/6b7b1bf262109cd3341e to your computer and use it in GitHub Desktop.
Miscellaneous
// Random number between 0 and n
let n = 42
let randomNumber = Int(arc4random_uniform(n))
// Instantiate a view controller that exists in a storyboard
let storyboardName = "Main"
let storyboard = UIStoryboard(name: storyboardName, bundle: nil)
let storyboardIdForViewController = "MyVC" // Specified in IB on the specific view controller instance
let myVc: MyViewController = storyboard.instantiateViewControllerWithIdentifier(storyboardIdForViewController) as! MyViewController
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment