I am developing an iPhone application. I have used mapkit to show the locations for user to select as source and destination. User also have option to see routes between source and destination. I need to implement the turn by turn navigation. I am using google maps. Is there any other way or any 3rd party library, by which I can implement turn by turn navigation?
Please google around before asking questions. There are tons of good tutorials (both free and paid on how to use mapkit.
This is one of them : http://www.ioscreator.com/search?q=mapkit
for turn by turn using maps I have this code snippet layout around here for Apple Maps :
let address = "\(self.street!) \(self.zip!) \(self.city!) \(self.country!)"
let geoCoder = CLGeocoder()
geoCoder.geocodeAddressString(address, completionHandler:
{(placemarks: [AnyObject]!, error : NSError!) in
if error != nil {
let errorAlert = UIAlertView(title: "Cannot locate address", message: "Geocode failed with error: \(error.localizedDescription)", delegate: self, cancelButtonTitle: "OK")
errorAlert.show()
}
if placemarks.count > 0 {
let placemark = placemarks[0] as! CLPlacemark
let location = placemark.location
println("\(location.coordinate.latitude) \(location.coordinate.longitude)")
let coords = location.coordinate
let place = MKPlacemark(coordinate: coords, addressDictionary: nil)
let mapItem = MKMapItem (placemark: place)
mapItem.name = locationName
let options = [MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving, MKLaunchOptionsShowsTrafficKey: true]
MKMapItem.openMapsWithItems([mapItem], launchOptions: options as [NSObject : AnyObject])
Google maps is pretty similar, and again very easy to find a well written tutorial online, this was my first hit using :
swift navigate google maps
as search keywords in google
http://www.appcoda.com/google-maps-api-tutorial/
PS I didn't downvote, but I understand why that person did it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With