Swift adding annotations on map

The function addAnnotation takes an array of type CLLocation, which is what you should use. So make the array look like this to initialize CLLocation objects. I assume you already have a working rendered map, mapView object, etc.

let coords = [  CLLocation(latitude: xxxx, longitude: xxxx),
   CLLocation(latitude: xxx, longitude: xxx),
   CLLocation(latitude: xxx, longitude:xxx)
    ];

here is a function that can take that array, and loops through each element and adds it as an annotation to the mapView (not yet rendered)

func addAnnotations(coords: [CLLocation]){
        for coord in coords{
            let CLLCoordType = CLLocationCoordinate2D(latitude: coord.coordinate.latitude,
                                                      longitude: coord.coordinate.longitude);
            let anno = MKPointAnnotation();
            anno.coordinate = CLLCoordType;
            mapView.addAnnotation(anno);
        }

    }

Finally, you need to use the MKMapViewDelegate delegate to use one of its automatically called methods, when a new annotation is added, so we can queue and render it. This would be unnecessary if you were adding annotations once, but it is good to have them added like this so you can manipulate them later.

func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
    if annotation is MKUserLocation{
        return nil;
    }else{
        let pinIdent = "Pin";
        var pinView: MKPinAnnotationView;
        if let dequeuedView = mapView.dequeueReusableAnnotationViewWithIdentifier(pinIdent) as? MKPinAnnotationView {
            dequeuedView.annotation = annotation;
            pinView = dequeuedView;
        }else{
            pinView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: pinIdent);

        }
        return pinView;
    }
}

Do not just add this code and expect it to work, make sure you incorporate it correctly, in the right areas of your project. Do comment if you have further questions.

UPDATE:

remember to inherit the MKMapViewDelegate protocol into the controller your using.

Make sure you actually call addAnnotations, in ViewDidLoad, and pass through coords array. Which can be defined in ViewDidLoad.

Make sure the mapView method is not in ViewDidLoad but a member of the controller.