title: How to turn setEditing state into toggle mode for Edit/Done button
body: <p>I am using a Edit/Done button to move an MKMapView upwards when Edit mode is selected, with the intention of display a message in an imageView at the bottom of the screen. My understanding is to change the function of this button I must use override func setEditing().</p>
  
  <p>While I can get it to change from Edit to Done mode once, with the corresponding title change, I can never get it to change back to Edit mode. The result being when you just press "Done" over and over it remains "Done" and keeps moving the MKMapView up.</p>
  
  <p>I want this to operate as a toggle but the process escapes me for some reason:</p>
  
  <pre><code>    override func setEditing(_ editing: Bool, animated: Bool) {
  super.setEditing(editing, animated: true)
  
  if editing {
      print("Are we editing NOW: \(isEditing)")
      mapView.frame.origin.y = -24
      editButtonItem.title = "Done"
  } else {
      print("Are we editing: \(isEditing)")
      mapView.frame.origin.y = 64
      editButtonItem.title = "Edit"
  }
  super.setEditing(editing, animated: true)
  </code></pre>
  
  <p>My attempted implementations of "isEditing" and "isEnabled" within my if/else statement haven't worked so far. What am I missing?</p>
  
  <p>EDIT:</p>
  
  <p>Well I came up with this approach, which works but seems clunky. </p>
  
  <pre><code>    override func setEditing(_ editing: Bool, animated: Bool) {
      super.setEditing(editing, animated: true)
  
      if editing {
          print("Are we editing NOW: \(isEditing)")
          mapView.frame.origin.y = -24
          editButtonItem.title = "Done"
      } else {
          print("Are we editing: \(isEditing)")
          mapView.frame.origin.y = 64
          editButtonItem.title = "Edit"
      }
      super.setEditing(editing, animated: true)
  }
  </code></pre>
  
  <p>I am having to use 64 as a value to get the mapView to return to the bottom the super view, not exactly sure why.</p>
  
  <p><a href="https://i.stack.imgur.com/22Ye5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/22Ye5.png" alt="Center view controller is the one in question"></a></p>