title: Dismiss last ViewController after the new ViewController is presented
body: <p>I open the same ViewController with a different variable, in case that is important:</p>
  
  <pre><code>@IBAction func buttonNextPostTapped(_ sender: UIButton) {
      //let postCount = posts.count
      //let postNumber = Int.random(in: 0 ..&lt; postCount)
      let currentVC = presentingViewController
      let storyBoard : UIStoryboard = UIStoryboard(name: "MainApplication", bundle: nil)
      let nextViewController = storyBoard.instantiateViewController(withIdentifier: "PostsViewController") as! PostsViewController
      //nextViewController.post = posts[postNumber]
      nextViewController.isFromRandom = true
      self.present(nextViewController, animated: true, completion: {
          currentVC?.dismiss(animated: true, completion: {})
          })
      }
  </code></pre>
  
  <p>When I tap the button, a new VC appears and the old VC moves to the background. When I tap the button multiple times, I have a lot VC in the background.</p>
  
  <p>How can I dismiss the previous VC, when the new VC is presented, so I will not have a lot of VCs in the background?</p>
  
  <p>Edit: With the current code, everything gets dismissed.</p>