title: How to pop a view controller better?
body: <p>I have a navigation controller with three views. Possible navigation routes are:</p>
  
  <p>VC1 -> VC3
  and<br>
  VC1 -> VC2 -> VC3</p>
  
  <p>When a user goes from VC1 to VC2 and ends up in VC3, I would like the back button in the navigation bar to point to VC1 (and not VC2). So in VC2, I added this piece of code.</p>
  
  <pre><code>override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
      self.navigationController?.popViewController(animated: true)
  }
  </code></pre>
  
  <p>It works; but I can see the pop happening. When I am on VC2 and in the process of navigating to VC3, I can see VC1 for a second (VC2 has been popped from the stack) and then I see VC3. It doesn't look nice.</p>
  
  <p>Is there a better way of doing this?</p>
  
  <p>Thanks.</p>