I hope the following example can explain me better to my question.
//Tengo mi mapa declarado
@IBOutlet weak var map: MKMapView!
//Defino mi locacion
let location = CLLocationCoordinate2DMake(latitud, longitud)
let span = MKCoordinateSpanMake(0.1, 0.1)
//genero un region en zoom
let region = MKCoordinateRegion(center: location, span: span)
//declaramos una anotacion
let annotation = MKPointAnnotation()
annotation.coordinate = location
annotation.title = "King David Kalakaua"
annotation.subtitle = "Waikiki Gateway Park"
//Agrego la región al mapa
map.setRegion(region, animated: true)
//Agrego la anotación al mapa
map.addAnnotation(annotation)
The following image shows the example of the previous code
My question is, if there is a way to generate the event click on the message window of the title and subtitle, for example, that it takes me to another ViewController and triggers a message. I really do not know if it's possible, and I'm just beginning to program in ios with swift and I'm a bit lost and in the official documentation I do not see it very clear, thanks:)