How to pass a "coordinates" variable to a function: didClickDetailDisclosure ?
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
guard annotation is MKPointAnnotation else { return nil }
...
let rightButton = UIButton(type: .detailDisclosure)
let coordinates = annotation.coordinate
rightButton.
rightButton.addTarget(self, action: #selector(didClickDetailDisclosure(button:)), for: .touchUpInside)
annotationView?.rightCalloutAccessoryView = rightButton
@objc func didClickDetailDisclosure(button: UIButton) {
performSegue(withIdentifier: "SegueAddFromMaps", sender: self)
}
Thanks for help!