Jon Gardocki Jon Gardocki - 1 month ago 4
Swift Question

I have two view controllers on the story board, I can connect one VC to code in one swift file, but can't connect the second.

So, as my title describes, I can connect one view controller in my story board to the first view controller.swift file but unable to connect the second view controller in story board to my second view controller.swift file. Any reason for this? Am I missing something?

Thanks for any help,
Jon

Answer

You can add a ViewController-class to your ViewController in your Storyboard by following the steps below:

enter image description here

But you have to make sure that you have created your class correctly.

To do that do the following:

  1. File->New->File->iOS-Source->Cocoa Touch
  2. At Subclass of you have to choose: UIViewController
  3. Add a name, click Next and Create
  4. Now you can add your created controller like mentioned above.