iOS - Split View Controller - How do I get a pointer (reference) to the Detail View Controller (the bigger right one) from inside the Master View Controller (the smaller lef
Create a property in your UISplitViewController subclass:
var _detailViewController: UIViewController? {
get {
if viewControllers.count > 1 {
return viewControllers[1] as? UIViewController
}
return nil
}
}
According to Apple's documentation, this should sometimes return nil, but in my experience, it always returns the detail view controller, regardless of state.
Also, do not call this property "detailViewController" instead of "_detailViewController" - Apple is apparently already using that name under the hood, and it will mess with your UI.
UISplitViewController is really hokey and needs a lot of cleanup and corrected documentation...