Instance Property

viewControllers

The array of view controllers managed by the receiver.

Declaration

var viewControllers: [UIViewController] { get set }

Discussion

When the split view interface is expanded, this property contains two view controllers; when it is collapsed, this property contains only one view controller. The first view controller in the array is always the primary (or master) view controller. If a second view controller is present, that view controller is the secondary (or detail) view controller.

When configuring the split view controller, you can use this property to assign the primary and secondary view controllers that you want displayed initially. After the split view controller is onscreen, you can use this property to get the view controllers in the split view interface. After the split view controller is onscreen, it is better to set the child view controllers using the showDetailViewController(_:sender:) or show(_:sender:) methods. Although you can still change the view controllers in this property directly, you should do so only if you manually manage your app’s view controller transitions.

See Also

Managing the Child View Controllers

var presentsWithGesture: Bool

Specifies whether a hidden view controller can be presented and dismissed using a swipe gesture.