title: Add subview to current view's UINavigationBar only
body: <p>What I want to do is add a custom view to my UINavigationController's <code>UINavigationBar</code> but only for the current visible view controller. </p>
  
  <p>So I build the subviews of the view I want to add in a container view and this view to the navigation bar by getting a reference with:</p>
  
  <pre><code>let navBar = navigationController?.navigationBar as UINavigationBar!
  </code></pre>
  
  <p>The result looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/k657E.png" alt="enter image description here"></p>
  
  <p>However, when I push another view controller in the <code>UINavigationController</code> stack, this subview persists in the <code>UINavigationBar</code> of the pushed viewControllers as well:</p>
  
  <p><img src="https://i.stack.imgur.com/zkn8A.png" alt="enter image description here"></p>
  
  <p>What's the best way to add this subview only in my current view's <code>UINavigationBar</code> and don't have it persisted on consecutive view controllers as well?</p>