title: IBAction to display latitude and longitude (swift)
body: <p>I have code that gets the users location. I want the user to be able to press a button and see their coordinates onscreen. how do I do this as I can't call myLat or MyLong for the button function directly as it is a location manager function. why isn't this code working? </p>
  
  <pre><code> func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
  
      // get most recient coordinate
      let myCoor = locations[locations.count - 1]
  
      //get lat &amp; long
      var myLat = myCoor.coordinate.latitude
      let myLong = myCoor.coordinate.longitude
      let myCoor2D = CLLocationCoordinate2D(latitude: myLat, longitude: myLong)
  
      //set span
      let myLatDelta = 0.05
      let myLongDelta = 0.05
      let mySpan = MKCoordinateSpan(latitudeDelta: myLatDelta, longitudeDelta: myLongDelta)
  
      let myRegion = MKCoordinateRegion(center: myCoor2D, span: mySpan)
      self.LocationManager.stopUpdatingLocation()
   }
  
  
  
  
  @IBAction func coo(sender: AnyObject) {
       self.coolat.text! = String(myLat)
       self.coolong.text! = String(myLong)
  }
  </code></pre>