In Swift, you should use the following syntax:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
Note that passing nil to bundle will cause the call to automatically reference your main package.
If you are in the view controller that you have on the storyboard, and you want to directly create a storyboard there, you can simply do:
let storyboard: UIStoryboard? = self.storyboard
Note that in the latter case, self.storyboard will return an optional storyboard ( Storyboard? ), So if you want to use it, unpack it like this:
if let storyboard = self.storyboard {
nburk Jul 20 '16 at 15:40 2016-07-20 15:40
source share