I would like to know how to embed multiple view controllers as child controllers of a container. I have tried to follow a few online tutorials but they all only use 2 controllers, not multiple. I have tried to convert their code to use more than 2 but have been unsuccessful. That is problem 1.
I found this great repo with very simple and easy to understand code for embedding 2 view controllers: https://github.com/mluton/EmbeddedSwapping
I tried to convert it to 3 but have not had any luck.
Problem #2 is that using this method I have not been able to navigate from one child view controller to another. I cloned the project and tried placing buttons on the child view controllers and then cntrl-drag to the next child to create a segue as one would do normally but no navigation happens when the button is tapped.
What I am trying to do in my project is display a view controller (the Start Screen) in a container view. I have a button on this view controller (Start Screen) which has a segue to Step 2 View Controller. I want Step 2 View Controller to display in the same container that Start Screen is. Then there is a button from Step 2 which goes to Step 3 and again I want it displayed in the same container view.
Are there any code samples online that do this which I can study? And/or do you happen to know how yourself and can share? I have been at this 3 days and no method I can think of has worked.
Although what you want to do is possible it's a pain to get working, ChildViewControllers are meant to be a one to one relation. If you want more you would have to add an intermediate view which connects to all the views. This intermediate view would be the one-one relation to your containerviewController.
However, based on your description I'm thinking you could fix this in a way more easy way. The flow you are describing is a typical navigation flow. Add a UINavigationController and connect that to your ContainerView, and just build your navigation stack like you would with a normal Navigation flow.