Reputation: 31
I have kinda big problem: When I add a view controller to my main.storyboard and then try to hook it up to viewcontroller.swift it won't connect, but my original one does how do I fix this?
Upvotes: 0
Views: 3678
Reputation: 28922
Here is a quick guide for how to properly add a new View Controller.
Create a new ViewController.swift using the keyboard command cmd
+n
. Choose the Cocoa Touch Class
Name it whatever you want & make sure it's a subclass of UIViewController
Create and save the new .swift file. Now, copy the name of your view controller.
In your storyboard, create a new view controller and select it.
On the right hand side, under Custom Class
, insert the new view controller's name (you should have copied that, so just hit paste) and hit enter
Hope that helps :)
Upvotes: 1
Reputation: 580
Each View Controller in story board should have it`s own subclass of UIViewController. You can create new by pressing cmd + n -> Cocoa Class -> Subclass of "UIViewController".
Upvotes: 0