Is there a way to have a single ContainerView with multiple embed segues? The aim is for a ContainerView to hold a few different ViewControllers depending on what buttons have b
I recognize this question is a bit old, but I wanted to answer in case you're still looking or other people find this. I had a similar issue and I worked around it.
In short, you'll have three layers:
- an external view controller ("ExternalViewController")
- a view controller manager ("ViewControllerManager")
- the child view controllers you actually want to be switching between ("ChildViewController")
Use a container view in ExternalViewController with an embed segue to the ViewControllerManager. ViewControllerManager itself would then hold other ChildViewControllers programmatically as described in this Apple documentation, specifically the section on adding and removing a child.
When you add a child view controller, set its frame to be the same as the ViewControllerManager's frame (since you're doing this inside the ViewControllerManager, set the child's frame equal to self.view.frame). You will also need some logic and an external control to do the switching inside of ExternalViewController, of course.
Hope this helps!