-
Notifications
You must be signed in to change notification settings - Fork 10
Integration Guide
Eric Internicola edited this page Jan 6, 2019
·
3 revisions
- See the Getting Started guide for the prerequisites
- It's assumed you've already installed
GeoTrackKit - It's assumed you've already updated your
Info.plistto allow access to Location Services
- Import
GeoTrackKit - Register with NotificationCenter for the
Notification.Name.GeoTrackKit.didUpdateLocationsnotification - When you catch that event, get the current track with
GeoTrackManager.shared.track - Optionally, compute stats about that track:
GeoTrackAnalyzer(track: GeoTrackManager.shared.track).calculate()
Importing GeoTrackKit:
import GeoTrackKitRegistering with Notification Center:
NotificationCenter.default.addObserver(self,
selector: #selector(locationDidUpdate(_:)),
name: Notification.Name.GeoTrackKit.didUpdateLocations,
object: nil)Implementing the Location Update function:
@objc
func locationDidUpdate(_ notification: NSNotification) {
let analyzer = GeoTrackAnalyzer(track: GeoTrackManager.shared.track).calculate()
// now update the UI from this
}