I am fairly new to xCode6 and am having difficulties getting my app to drop a pin on my current location. What I would like to do is to allow the user to mark his/her current location with a pin by pressing the button "drop pin", and then capture the long and lat of that coordinate - preferably in a println().
I have searched around for a bit, but not found anyone explaining this in swift or xcode6. As I have no idea how to translate from whatever old language was used to swift I figured I'd post the question here.
I have the following code, please help me out.
I have searched around for a bit, but not found anyone explaining this in swift or xcode6. As I have no idea how to translate from whatever old language was used to swift I figured I'd post the question here.
I have the following code, please help me out.
Code:
import UIKit
import MapKit
import CoreLocation
class ViewController: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate {
@IBOutlet var myMap : MKMapView!
let locationManager = CLLocationManager()
override func viewDidLoad() {
super.viewDidLoad()
self.locationManager.delegate = self
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest
self.locationManager.requestWhenInUseAuthorization()
self.locationManager.startUpdatingLocation()
self.locationManager.requestWhenInUseAuthorization()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func satelliteView(){
myMap.mapType = MKMapType.Satellite
}
@IBAction func normalView(){
myMap.mapType = MKMapType.Standard
}
@IBAction func dropPin(){
}
}
Last edited by a moderator: