Search code examples
iosswiftuiviewcontrollersegue

How to perform a segue from a view container to another external view?


I have a view container that contains different view controllers in it when the user presses a button the view changes just inside the container, the parent view stays unchanged. I need to perform a segue from one of the views managed by the container to another external view, so I need the parent view to change. If I use a normal segue from the storyboard the view it's going to be displayed in the container, how do I change that so the parent view can change?


Solution

  • if the parent view is an UIViewController then you can open the view by doing:

    self.present(viewController: externalView)
    

    from the parent view controller.