Skip to content

Latest commit

 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GPSwift

GPSwift allows you to simple connect to CoreLocation framework and returns address in human readable format.

GPSwift.swift

File creates singleton class to provide geo location update data in human readable structure.

Install

Copy GPSwift.swift file to your project.

In viewController just create variables of CLLocationManager and GPSwift:

var locationManager = CLLocationManager()
var gpsLocation: GPSwift!

Create singleton instance:

gpsLocation = GPSwift.sharedGPS

Then just simple start locating:

gpsLocation.startLocating()

or stop locating:

gpsLocation.stopLocating()

After succesfull location update GPSwift singleton post observer named locationChangedNotification. So add observer to viewController like this:

NSNotificationCenter.defaultCenter().addObserver(
    self,
    selector: "locationHasChanged",
    name: locationChangedNotification,
    object: nil)

Then use function locationHasChanged to read geo located address:

func locationHasChanged() {
    println("\(gpsLocation.address.thoroughfare)")
    println("\(gpsLocation.address.subThoroughfare)")
    println("\(gpsLocation.address.locality)")
    println("\(gpsLocation.address.postalCode)")
    println("\(gpsLocation.address.ISOcountryCode)")
}

And that's it.

Happy geo locating.

Screens

Preview

Preview

About

GPSwift allows you to simple connect to CoreLocation framework and returns address in human readable format.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages