Xcode - How can i programmatically embed/change view controller within a container view?

Viewed 14663

I am trying to programmatically set / or change the embedded View Controller inside a Controller View.

I have 3 different View Controllers, that I would like to show in the Container View, all depending on if the user is logged in or not.

I have looked around and tried a bunch of code, I found one that worked, but the code changed the self view, and not the view containers view.

A lot of the code I have tried have also not been in Swift 3, so as a new app developer, this has been quite stressful, as I tried to convert it to Swift 3.

Can anyone provide a solution for changing the embedded view controller inside a view container? Thanks.

2 Answers
Related