-
Notifications
You must be signed in to change notification settings - Fork 9
Live Mapping
Eric Internicola edited this page Jan 6, 2019
·
2 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.plist
to allow access to Location Services
- For Reference, see LiveTrackingViewController.swift
- Import
GeoTrackKit
- Add a map to your view controller:
@IBOutlet weak var liveMapView: GeoTrackMap!
- Register with NotificationCenter for the
Notification.Name.GeoTrackKit.didUpdateLocations
notification - When you catch that event update the map
Importing GeoTrackKit:
import GeoTrackKit
Registering with Notification Center:
NotificationCenter.default.addObserver(self,
selector: #selector(locationDidUpdate(_:)),
name: Notification.Name.GeoTrackKit.didUpdateLocations,
object: nil)
@objc
func locationDidUpdate() {
guard let track = GeoTrackManager.shared.track else {
return
}
liveMapView.model = UIGeoTrack(with: track)
}