title: Get center coordinates from MapKit and display in UILabel
body: <p>I'm developing an iOS app using XCode 7.2 and Swift 2.1, and I've successfully implemented a MapKit map in my app.  The map loads perfectly and centers on the user's current location.</p>
  
  <p>Now I want to retrieve the center coordinates should the user move the center of the map to a new location.  This new location's coordinates will be "captured" on the press of a button (see the "Set Grid Reference" button in the attached gif) and be displayed in a label.</p>
  
  <p><a href="https://i.stack.imgur.com/F9Y1t.gif" rel="nofollow noreferrer">Move from A to B and set new center coordinates</a></p>
  
  <p>The closest I've come to an answer is <a href="https://stackoverflow.com/questions/32705790/get-location-from-center-of-screen-swift-mapkit">here</a>, and I've implemented that code, but I still can't figure out how to update the label with the coordinates by clicking the IBOutlet button I've created.</p>
  
  <p>What am I missing here?!</p>
  
  <p>Any help would be highly appreciated - thanks in advance!</p>
  
  <p>----------------FOLLOW-ON QUESTION------------------</p>
  
  <p>Now that we've solved the problem and we got the label populated with the new center coordinates, I have one more question - most probably a noob oversight, but I'm on a steep learning curve here, so please bear with me...</p>
  
  <p>We have successfully determined the center coordinates and they are now set as <strong>mapLongitude</strong> and <strong>mapLatitude</strong> inside the function we've created.</p>
  
  <p>I have two other variables (<strong>newTargetLong</strong> and <strong>newTargetLat</strong>) that forms part of an array of values that will be passed on to the next view controller, and I want to:</p>
  
  <pre><code>let newTargetLong = mapLongitude
  let newTargetLat = mapLatitude
  </code></pre>
  
  <p>so that the new latitude and longitude can be added to the array with an <code>.append</code> instruction.</p>
  
  <p>But for some reason, I just can't get those two values "out" of that function.  What do I need to do to accomplish that?</p>