Been trying to check if the detailView is being presented in a splitViewController. This is on a iPhone in portrait mode so only 1 view is being shown on the screen. I need to present a modal with contextual actions for the detailview but I need to check that the detail view is actually presented.
So far I have tried:
if splitViewController.isCollapsed == false {
// .. always true regardless if im in the master view or detail so doesn't help
}
if splitViewController.displayMode == .primaryHidden {
print("Detail view is visible")
// Doesn't return true in detailView
}
Is there some other way of checking?
Found out like this by trying to log all the things:
print(splitViewController.childViewControllers[0]) // UINavigationController
let navigationcontroller = splitViewController.childViewControllers[0] as! UINavigationController
print(navigationcontroller.visibleViewController) // MasterViewController