I have many annotations in a mapview (with rightCalloutAccessory buttons). The button will perform a segue from this mapview to a tableview>
rightCalloutAccessory
mapview
tableview>
Just use this function.
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { let index = CategorytableView.indexPathForSelectedRow let indexNumber = index?.row let VC = segue.destination as! DestinationViewController VC.value = self.data }