Navigate Route
- UIKit
- SwiftUI
This example demonstrates how to use GEMKit in a UIKit application to calculate a route using the device's real GPS position as the departure point and navigate it turn-by-turn with voice guidance.
Check the full implementation on GitHub.



UI and Map Integration
The view controller manages a MapViewController, a PositionContext for GPS tracking, and a DataSourceContext configured for automotive navigation:
Follow Position Preferences
Persistent follow position is enabled so that the user's zoom and tilt adjustments are remembered during simulation/navigation until clearing the NavigationContext:
Calculating and Starting Navigation
After the route is calculated, tapping play starts real GPS navigation. A SoundContext provides TTS turn announcements and an AlarmContext monitors safety cameras:
Getting GPS Position and Calculating the Route
The route button reads the current device location from PositionContext and uses it as the departure point. The destination is set by tapping a landmark or street on the map. Tapping the play button then calls navigate(withRoute:) to begin real GPS navigation:
Navigation Instruction Updates
navigationInstructionUpdatedForRoute is the primary delegate callback that fires on every navigation tick. It updates ETA, remaining time and distance, lazily creates the panel on the first call, then feeds turn, lane, traffic, signpost, safety camera and social report data into the panel on each subsequent update:
Navigation Panel
The NavigationViewController used in this example is a full-featured turn-by-turn panel displaying turn images, distance, lane guidance, traffic events, signpost overlays, and safety alerts. Due to its size it is not reproduced here — check the full implementation on GitHub.
This example demonstrates how to use GEMKit in a SwiftUI application to calculate a route using the device's real GPS position as the departure point and navigate it turn-by-turn with voice guidance.
Check the full implementation on GitHub.



Map View and Navigation Panel
Navigation state is managed in NavigateRouteModel. The view switches between a route summary and live navigation MapRoute, and shows a NavigationPanelView overlay during navigation. Map delegate modifiers handle tapping landmarks and streets to set the destination:
GPS Position, Route Calculation and Starting Navigation
The model sets up a DataSourceContext and PositionContext for GPS. calculateRoute(_:) reads the current location from positionContext.getPosition() and uses it as the departure point. startNavigation(_:) calls navigate(withRoute:) and a NavigationHandler closure handles all delegate callbacks:
The NavigationPanelView used in this example is a full-featured SwiftUI turn-by-turn panel displaying turn images, distance, lane guidance, traffic events, and safety alerts. Due to its size it is not reproduced here — check the full implementation on GitHub.