So richten Sie ein Array für Multi-Annotationen mit swift @ e
Wie soll das Array darunter gesetzt werden? Ich versuche, mehrere Anmerkungen auf meiner Karte hinzuzufügen. Ich konnte den folgenden Code auf stackoverflow finden, aber sie zeigten nicht, wie man das Array einrichtet.
var objects = [
//how should the array be setup here
]
for objecters in objects!{
if let latit = objecters["Coordinates"]["Latitude"]{
self.latitudepoint = latit as! String
self.map.reloadInputViews()
}
else {
continue
}
if let longi = objecters["Coordinates"]["Longitude"]{
self.longitudepoint = longi as! String
self.map.reloadInputViews()
}
else {
continue
}
var annotation = MKPointAnnotation()
var coord = CLLocationCoordinate2D(latitude: Double(self.latitudepoint)!,longitude: Double(self.longitudepoint)!)
mapView.addAnnotation(annotation)
}