show(_:sender:)
Presents the specified view controller as the primary view controller in the split view interface.
Declaration
func show(_ vc: UIViewController, sender: Any?)Parameters
- vc:
The view controller to display in the primary location of the split view interface.
- sender:
The object that made the request to show the view controller.
Discussion
Whenever possible, use this method (instead of modifying the contents of the viewControllers property directly) to replace the primary view controller of your split view interface. This method displays the specified view controller in a way that’s optimal for the current size class in effect.
Typically, you call this method from an action method when you want to replace the primary view controller with the one specified in vc. This method calls the split view controller delegate’s splitViewController(_:show:sender:) method to give the delegate an opportunity to show the view controller. If the delegate does not show the view controller, the split view controller shows it using the following heuristics:
In a horizontally regular environment, the split view controller installs
vcas the primary view controller unlessvcis already a child of the primary view controller. In that case, it installsvcas the secondary view controller.In a horizontally compact environment, the split view controller presents
vcmodally.