title: Presenting one ViewController over another partially
body: <p>I have a <code>MapViewController</code> that is basically a <code>MKMapView</code> and presents a map with custom annotations.</p>
  
  <p>Right now I am trying to present another ViewController from the bottom containing additional filters that the user will be able to use on his journey.</p>
  
  <p>However I ran into a problem, when I am presenting the new <code>FilterMenuViewController</code> as a child of <code>MapViewController</code> the <code>MapViewController</code> disappears.</p>
  
  <p>This is what it looks like:</p>
  
  <p><a href="https://i.stack.imgur.com/rZnIk.png" rel="nofollow noreferrer">Initial state</a></p>
  
  <p><a href="https://i.stack.imgur.com/hYCwd.png" rel="nofollow noreferrer">Button to present new controller tapped</a></p>
  
  <p><a href="https://i.stack.imgur.com/ecdPX.png" rel="nofollow noreferrer">New controller presented but the MapViewController disappearing</a></p>
  
  <p>The code that takes care of the interaction is as follows:</p>
  
  <p><code>MapViewController</code> variables declaration:</p>
  
  <pre><code>var filterMenuVC = FilterMenuViewController()
  var isFilterMenuOpened = false
  </code></pre>
  
  <p><code>MapViewController viewDidLoad()</code>:</p>
  
  <pre><code>    filterMenuVC = storyboard?.instantiateViewController(withIdentifier: "FilterMenuViewController") as! FilterMenuViewController
  </code></pre>
  
  <p><code>MapViewController showFilterMenu</code> button action:</p>
  
  <pre><code>@IBAction func showFilterMenu(_ sender: UIButton) {
      // Presents the filter menu
      if isFilterMenuOpened == true {
          isFilterMenuOpened = false
          filterMenuVC.willMove(toParentViewController: nil)
          filterMenuVC.view.removeFromSuperview()
          filterMenuVC.removeFromParentViewController()
      } else if isFilterMenuOpened == false {
          isFilterMenuOpened = true
          self.addChildViewController(filterMenuVC)
          self.view.addSubview(filterMenuVC.view)
          filterMenuVC.didMove(toParentViewController: self)
      }
  } 
  </code></pre>