Segue to multiple UIViewController files

I have multiple UIViewController files (e.g. RootViewController and ValuesViewController) in Xcode 8.2. How do I segue from RootViewController to ValuesViewController?

Replies

I suppose you want to segue when you tap a button in Root.

To create the segue, in IB, you just control drag from the button in Root to Values and select the type of segue in the popup that appears.


You should also give an identifier to the segue, in IB.


If you have to tranfer values from Root to Values, then do it in preprare for segue.


May read those tutorials for very detailed explanations.

h ttps://www.raywenderlich.com/464-storyboards-tutorial-for-ios-part-1

That works if both ViewControllers are in the same (original) storyboard. Sadly, when configured that way, I can't use TextFields to display values or connect buttons to code. I created a second ViewController.swift file to display the values. I can't figure out how to segue to that file from the original VC (root). Ultimately, I would like to use a NavigationController to accomplish this.

You certainly can use text fields and buttons from a storyboard. Perhaps you didn’t have the view controller’s custom class (identity inspector) set correctly on the storyboard. If that’s not set to your VC subclass, you can’t connect outlets or actions.

That works if both ViewControllers are in the same (original) storyboard.


So, you have multiple storyboards in your app ? That was not clear in your original post. And a bit surprising if you have only a few view controllers.


Sadly, when configured that way, I can't use TextFields to display values or connect buttons to code.


Why can't you do it ?

Are you sure you have declared (in IB) the view controller class to be the class you created ?