title: Swift: Get user's location coordinates as latitude and longitude?
body: <p>When a user presses a button, I'd like to store their latitude and longitude as variables. I don't understand how to use the Coordinate2D method. Instead of println(locManager.location) I would like to print (or store as separate variables) the latitude and longitude. Please help. My code is below.</p>
  
  <pre><code>class ViewController: UIViewController, CLLocationManagerDelegate {
  
    var locManager = CLLocationManager()
  
    @IBOutlet var pushToParkText: UILabel!
  
    @IBAction func carButton(sender: UIButton) {
      println(locManager.location)
    }
  
    @IBOutlet var labelLatitude: UILabel!
    @IBOutlet var labelLongitude: UILabel!
  
    override func viewDidLoad() {
      super.viewDidLoad()
  
      // Core Location Manager asks for GPS location
      locManager.delegate = self
      locManager.desiredAccuracy = kCLLocationAccuracyBest
      locManager.requestWhenInUseAuthorization()
      locManager.startMonitoringSignificantLocationChanges()
  
      // Check if the user allowed authorization
      if (CLLocationManager.authorizationStatus() == CLAuthorizationStatus.AuthorizedWhenInUse ||
          CLLocationManager.authorizationStatus() == CLAuthorizationStatus.Authorized)
      {       
          println(locManager.location)
  
          } else {
              labelLatitude.text = "Location not authorized"
              labelLongitude.text = "Location not authorized"
          }
      }
  }
  </code></pre>