tanjyy / ridesio

Ridesharing iOS application for college students. Won 2nd place in the iOS category at CodePath Demo Day 2020.
https://tanjyy.github.io/ridesio
1 stars 1 forks source link

User should see a mapkit view showing the trip on the ride details page #96

Closed nashirj closed 3 years ago

nashirj commented 3 years ago

https://guides.codepath.com/ios/Maps

nashirj commented 3 years ago

Here is code for opening the trip in maps (which should happen when you click on the map on the details page)

let sourcePlacemark = MKPlacemark(coordinate: CLLocationCoordinate2D(latitude: sourceLat, longitude: sourceLong))
let source = MKMapItem(placemark: sourcePlacemark)

source.name = "Source"

let destPlacemark = MKPlacemark(coordinate: CLLocationCoordinate2D(latitude: destLat, longitude: destLong))
let destination = MKMapItem(placemark: destPlacemark)

destination.name = "Destination"

MKMapItem.openMaps(with: [source, destination], launchOptions: [MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving])