Preview Offline Map

The preview screen must register the active map style and may be configured to read tiles only from the cache. Focus the region bounds before enabling cache-only mode so local map data can be verified clearly.

Map preview:

1
NBNavigation.registerOfflineMapStyle(
2
mapView: mapView,
3
styleURL: mapView.styleURL
4
)
5
6
_ = try NBNavigation.focusOfflineMapRegion(
7
mapView: mapView,
8
regionId: String(regionId)
9
)
10
NBNavigation.enableCacheOnlyPreview(mapView: mapView)
11
12
// Restore network tile fetching when leaving cache-only preview.
13
NBNavigation.disableCacheOnlyPreview(mapView: mapView)

If the routing catalog is available but the map catalog or installed map packages fail to load, the screen may still display a region row while the preview has missing tiles. Check the component error fields from fetchRegionLists and mapInstalledRegionList instead of treating a blank map as evidence that routing data was lost.