I have a document-based app which displays a view controller with a navigation bar (i.e. it's inside a navigation controller) which is also the detail view controller of a split view controller. I'm using this sample code to just show a back button in the navigation bar of the document view controller:
class DocumentViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
splitViewController!.presentsWithGesture = false
navigationItem.backAction = UIAction(handler: { _ in
})
}
}
In a regular width, this works as expected: only the back button is displayed. In a compact width such as a portrait iPhone, the split view seems to display the navigation bar button to show the master view controller (the one with the icon to the right of the back button, labeled “Root View Controller").
According to the documentation of presentsWithGesture
:
When this property is false, the split view controller doesn’t install a gesture recognizer for changing the display mode. The split view controller also doesn’t display a button to change the display mode.
Is this a bug, or an error in the documentation, or am I doing something wrong?