Better Route Notification
- UIKit
This example demonstrates how to use GEMKit in a UIKit application to detect when a faster alternate route becomes available during navigation and then offer it to the user.
Check the full implementation on GitHub.



UI and Map Integration
The view controller tracks both the active route and any detected better route, displaying a dedicated button when an improvement is found:
Routing Preferences for Better Route Detection
setAvoidTraffic(true) is set on the route preferences so that the engine also actively monitors for traffic-aware alternatives:
In order for a better route to be detected, the user must be on a route that is not the fastest option. Make sure you have selected the slower alternative in the initial route selection.
Presenting and Acting on the Better Route
When a better route is detected, a green button appears. Tapping it shows both routes side-by-side using showBetterRoute(_:withTraffic:timeGain:showSummary:):
Resuming on Selected Route
When the user taps the position button, this method checks whether the better route was selected and continues simulation on it accordingly:
Detecting a Better Route
The onBetterRouteDetected delegate fires when a faster alternative is found. Time gained is rounded to minutes, announced via TTS, and the better route is stored so the user can choose to switch. If the alternate is later invalidated, the original route display is restored: