Context
MapViewDirections (#7) uses the Google Directions API, which requires an API key and billing. On iOS, MapKit provides native routing via MKDirections with no Google dependency — useful for apps that default to Apple Maps (provider="apple" after #1) or want to avoid Directions API costs on iOS.
react-native-maps-directions is Google-only. This issue adds an optional native routing path as a differentiator for @nitro-maps/directions.
Goal
Allow MapViewDirections to compute routes using MapKit on iOS when configured:
<MapViewDirections
origin={origin}
destination={destination}
routingProvider="mapkit" // or auto-detect from MapView provider
mode="DRIVING"
onReady={({ coordinates, distance, duration }) => { … }}
/>
Scope
- Define routing provider strategy:
routingProvider?: 'google' | 'mapkit' | 'auto'
auto: use MapKit on iOS when MapView uses Apple provider; Google elsewhere
- Implement iOS native module or Nitro hybrid (evaluate lightest approach):
- wrap
MKDirections / MKDirections.Request
- support transport types mapping to
mode where possible (automobile, walking, transit)
- return decoded route polyline as
Coordinate[]
- return distance (meters → km) and expected travel time (seconds → minutes) for
onReady parity
- Wire native adapter into
@nitro-maps/directions fetch layer behind shared interface.
- Handle errors: no route found, network unavailable, unsupported transport type.
- Document platform limitations:
- MapKit only on iOS
- transit details may differ from Google
- waypoints support per MKDirections capabilities
- Add example app toggle: Google Directions vs MapKit (iOS simulator).
Out of scope
Acceptance criteria
Implementation notes
Prefer a thin Nitro spec if other native routing adapters are planned (#1 multi-provider). Otherwise a minimal MKDirectionsModule may suffice for v1.
Shared interface sketch:
interface RoutingAdapter {
fetchRoute(request: RouteRequest): Promise<RouteResult>;
}
Notes
Depends on #6 and #7. Can ship after Google Directions parity (#7–#9). Optional for v1.0 — Google-only directions may ship first.
Context
MapViewDirections(#7) uses the Google Directions API, which requires an API key and billing. On iOS, MapKit provides native routing viaMKDirectionswith no Google dependency — useful for apps that default to Apple Maps (provider="apple"after #1) or want to avoid Directions API costs on iOS.react-native-maps-directions is Google-only. This issue adds an optional native routing path as a differentiator for
@nitro-maps/directions.Goal
Allow
MapViewDirectionsto compute routes using MapKit on iOS when configured:Scope
routingProvider?: 'google' | 'mapkit' | 'auto'auto: use MapKit on iOS whenMapViewuses Apple provider; Google elsewhereMKDirections/MKDirections.Requestmodewhere possible (automobile, walking, transit)Coordinate[]onReadyparity@nitro-maps/directionsfetch layer behind shared interface.Out of scope
Acceptance criteria
routingProvider="mapkit"renders a route on iOS without a Google API key.onReadyreturns coordinates, distance (km), and duration (minutes) consistent with Add MapViewDirections core — Google Directions API and route polyline #7 callback shape.modeon MapKit fails gracefully withonError.routingProvider="google".Implementation notes
Prefer a thin Nitro spec if other native routing adapters are planned (#1 multi-provider). Otherwise a minimal
MKDirectionsModulemay suffice for v1.Shared interface sketch:
Notes
Depends on #6 and #7. Can ship after Google Directions parity (#7–#9). Optional for v1.0 — Google-only directions may ship first.