29

Here’s a nice simple to use Swift based library for gathering the current location of the user or with built in permission handling called WhereAmI from Romain Rivollier.

You can set whereAmI to ask for when in use or always permissions, chose bettween different location accuracy profiles, and you can gather one time locations or continuously updated locations all with just a few lines of code. You can also retrieve address details if desired.

This simple example of the readme shows how to gather the current location, continuously update, and handle the location data:

//If you want continuous update
WhereAmI.sharedInstance.continuousUpdate = true;

//Request the current location
WhereAmI.sharedInstance.whereAmI({ (location) -> Void in
    //Use the location data        
}, locationRefusedHandler: {(locationIsAuthorized) -> Void in
    if (!locationIsAuthorized) {
        //The location authorization has been refused
    }
});

You can find WhereAmI on Github.