UISplitViewController with ContainerView

I have an onboarding class that uses UIPageViewController in a container view. The container view is smaller than the app's window to allow use of features behind the container view. This works very nicely in my previous use case.


But now I would like use the same onboarding class in an app that uses UISplitViewController. The container view needs to show regardless of the UISplitViewController's display mode.


In my previous implementations I would eventually eventually use


onboardingHandler.didMove(toParent: viewController)


onboardingHandler is my UIPageViewController subclass and viewController is the parent.


In a UISplitViewController, which is the parent?


How can I reliably detect the parent so my onbaording is always on top?

Is it a Master-Detail setup ?


I would use DetailViewController as parent, as it is always displayed.


Or call directly the childView parent:

childView.parent



parent

The parent view controller of the recipient.

Declaration

weak var parent: UIViewController? { get }

Discussion

If the recipient is a child of a container view controller, this property holds the view controller it is contained in. If the recipient has no parent, the value in this property is

nil
.

Prior to iOS 5.0, if a view did not have a parent view controller and was being presented, the presenting view controller would be returned. On iOS 5, this behavior no longer occurs. Instead, use the

presentingViewController
property to access the presenting view controller.


>In a UISplitViewController, which is the parent?


See https://developer.apple.com/documentation/uikit/uiviewcontroller/1621362-parent


And from the docs on 'Order of Containment': https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/CombiningViewControllers.html


-=-

Combined View Controller Interfaces

You can use the view controllers that the UIKit framework provides by themselves or in conjunction with other view controllers to create even more sophisticated interfaces. When combining view controllers, however, the order of containment is important; only certain arrangements are valid. The order of containment, from child to parent, is as follows:

  • Content view controllers, and container view controllers that have flexible bounds (such as the page view controller)
  • Navigation view controller
  • Tab bar controller
  • Split view controller

-=-

UISplitViewController with ContainerView
 
 
Q