title: How to correctly dismiss previous view controller
body: <p>Apologies as I know there are some similar questions, but I've been looking for two weeks through every one I can find, and cannot figure it out (I'm a bit of a novice).</p>
  
  <p>I have a few different View Controllers, not using a Navigation Controller. I can segue between them no problem. The issue is, I need each view to be dismissed when I segue to a new one. Here is some of what I've tried so far.</p>
  
  <p>Option 1 (in new View Controller)</p>
  
  <pre><code>override func viewDidAppear(_ animated: Bool) {
      presentingViewController?.dismiss(animated: false, completion: nil)
  }
  </code></pre>
  
  <p>Option 2 (in old View Controller)</p>
  
  <pre><code>override func viewDidDisappear(_ animated: Bool) {
      self.dismiss(animated: false, completion: nil)
  }
  </code></pre>
  
  <p>In both of these cases, the new view gets dismissed and I'm taken back to the old view. I've tried about 20 versions of similar code.</p>
  
  <p>Should I be using the first VC in my program as my "main" view controller, and presenting/dismissing all others on top of it? I didn't think this approach seemed memory efficient, when the "main" VC is not often used after initially loading the app.</p>
  
  <p>It seems like I'm missing or not understanding something. Any help would be greatly appreciated.</p>