class MyCViewContollerClass:UIViewController{
var button = UIButton()
}
let storyBoard = UIStoryboard()
let viewController = storyBoard.instantiateViewController(withIdentifier: "vc") as! MyCViewContollerClass
Asked
Active
Viewed 32 times
0

Nirav D
- 71,513
- 12
- 161
- 183

Ekramul Hoque
- 672
- 4
- 17
-
Did you set `MyCViewContollerClass` as the class of the view controller with identifier "vc"? – Mo Abdul-Hameed Jun 10 '17 at 12:01
-
Are you using storyboard in Interface Builder? – vadian Jun 10 '17 at 12:02
-
No i am using playground .. – Ekramul Hoque Jun 10 '17 at 12:03
1 Answers
1
You need to load your storyboard from file:
let storyboard = UIStoryboard(name: "MyStoryboardName", bundle: nil)
Or, if you haven't storyboard, you can just create your view controller programmatically:
let viewController = MyCViewControllerClass()

raver
- 263
- 6
- 14