Reputation: 1683
I want to display several pins in map view. So I do:
let smth = [Smth(title: "Title 1",
locationName: "Street 1",
coordinate: CLLocationCoordinate2D(latitude: 43.2345965, longitude: 76.8907758)),
Smth(title: "Title 2",
locationName: "Street 2",
coordinate: CLLocationCoordinate2D(latitude: 43.2059723, longitude: 76.9012738))]
then:
mapView.addAnnotation(smth)
but it shows this error:
Argument type '[Smth]' does not conform to expected type 'MKAnnotation'.
What should I do? Thanks.
Upvotes: 1
Views: 237
Reputation: 1683
Solved this:
mapView.addAnnotations(smth)
Arrays require the method "addAnnotations", not "addAnnotation".
Upvotes: 3