title: Back Navigation from Embedded UISplitViewController Using Single Navigation Bar
body: <p>I’d like to have split views in several places of my iOS app, none of them as the root view controller. I understand that split views are initially designed to sit at the root of the app and provide the root navigation controller, and that Apple’s guidelines initially did not allow any workarounds. Updated guidelines state </p>
  
  <blockquote>
    <p>You cannot push a split view controller onto a navigation stack. Although it is possible to install a split view controller as a child in some other container view controllers, doing is not recommended in most cases.</p>
  </blockquote>
  
  <p>Now the split view pattern would really benefit my app, and I don’t want to reinvent the wheel here, so I gave it a try using a container view, mainly using the following steps:</p>
  
  <ol>
  <li>Create a scene with a regular <code>UIViewController</code>.</li>
  <li>Add a <code>UIContainerView</code> covering the entire screen.</li>
  <li>Add a <code>UISplitViewController</code> to the storyboard, which creates a split view controller, a navigation controller, a table view controller (for the master view), and a regular view controller (for the detail view).</li>
  <li>Create an embed segue from the container view to the split view controller.</li>
  </ol>
  
  <p>This has a few quirks, which I hope to iron out eventually (e.g. initially showing detail view, swiping in the table view from the left on an iPad apparently tries to also back nav on the main navigation), but it basically works. So far, so good.</p>
  
  <p>Now, the <strong>problem is that I have two navigation controllers: the main navigation controller at the root of my app and the navigation controller in the embedded split view</strong>. This gives me two navigation bars with independent navigation, allowing me to:</p>
  
  <ul>
  <li>navigate back to the root of the split view using the embedded navigation controller</li>
  <li>navigate back from the container view in the enclosing navigation controller</li>
  </ul>
  
  <p>Besides two navigation bars not being appealing, I don’t want iPhone users to perform the second directly from the detail view. So my next steps were:</p>
  
  <ol>
  <li>hide the navigation bar in the outer view controller</li>
  <li>add a back navigation button to the inner navigation bar to take over the role of the main navigation bar’s back button</li>
  </ol>
  
  <p>Left to do is the implementation for that back button that pops the container's view controller of the main navigation stack. The question is: how can I access the main navigation controller from the embedded view that has its own navigation controller (using Swift)?</p>