I'm attempting to pass data to a label on my second VC through the function func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView)
.
func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {
print("Annotation selected")
if let annotation = view.annotation as? POIAnnotations {
let destVC : ShopDetailViewController
destVC.shopName.text = annotation.title!
print("Your annotation title is: \(annotation.title!)")
}
}
When I set shopName.text
to annotation.title
, I get an error stating:
Constant 'destVC' used before being initialized.
I'm not quite sure what's going wrong.