Home Getting Directions From an Annotation on the Map
 I am trying to get directions from any annotations that are found on my map. I am using CloudKit as a database to store all my user's information. The annotations use the location index in CloudKit to map out their location on the map. Every time I run my code the annotation comes back as nil, how do I get my code to recognize the location from the annotation and return directions from apple maps? @IBAction func getDirections(_ sender: Any) { let view = MKPointAnnotation().coordinate print("Annotation: \(String(describing: view ))") let currentLocMapItem = MKMapItem.forCurrentLocation() let selectedPlacemark = MKPlacemark(coordinate: view, addressDictionary: nil) let selectedMapItem = MKMapItem(placemark: selectedPlacemark) let mapItems = [selectedMapItem, currentLocMapItem] let launchOptions = [MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving] MKMapItem.openMaps(with: mapItems, launchOptions:launchOptions) }