https://github.com/williamfalcon/wflocationservice
Simplest Location Service for iOS. In Swift
https://github.com/williamfalcon/wflocationservice
Last synced: 8 months ago
JSON representation
Simplest Location Service for iOS. In Swift
- Host: GitHub
- URL: https://github.com/williamfalcon/wflocationservice
- Owner: williamFalcon
- License: mit
- Created: 2015-06-17T17:28:57.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2016-02-22T16:41:54.000Z (over 10 years ago)
- Last Synced: 2025-01-22T11:47:42.263Z (over 1 year ago)
- Language: Swift
- Size: 13.7 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#WFLocationService
Simplest way to get a user's location on iOS.
Written 100% in Swift
##To Use
1. Include the [WFLocationService] (https://github.com/williamFalcon/WFLocationService/tree/master/WFLocationService) folder in your app. (Cocoapods coming soon).
2. Add the [NSLocationWhenInUseUsageDescription] (https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html) or [NSLocationAlwaysUsageDescription] (https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html) key to your info.plist
###Get a location
- Calling this method requests location services authorization then handles result accordingly.
- Will be called multiple times if a more accurate location is found.
````swift
LocationService.getCurrentLocationWithProgress({ (latitude, longitude, accuracy, locationObj) -> () in
//Called when a better location is available (could be multiple times)
}, onComplete: { (latitude, longitude, accuracy) -> () in
//Called when update timer expires
}) { (error) -> () in
//Called on failure
}
````
###Change Location Accuracy
Default is 30 meters. Change with the following code:
````swift
var newAccuracy : Double = 10.0
LocationService.setLocationAccuracy(meters: newAccuracy)
````
###Change How long LocationService looks for new locations
Default is 10 seconds. Change with the following code:
````swift
var stopUpdatesTimeInSeconds : Double = 5.0
LocationService.setLocationUpdateTimeLimit(seconds: stopUpdatesTimeInSeconds)
````
###User Location Authorization
It will request authorization automatically. It will handle the authorization result accordingly.
####Author
William Falcon. will@hacstudios.com
Feel free to contact me for iOS development inquiries.