This section instructs how to register an offline-compatible map style, synchronize installed map data with the map engine, and switch to cache-only tile fetching when needed.
let styleNames =NGLRegionalOfflineStyleCatalog.styleNames
The current catalog includes Bright, Dark, Satellite, SatelliteStreet, NavDay, and NavNight. Register the new URL again whenever the application changes styles.
Synchronize the map when the page appears
1
overridefuncviewWillAppear(_ animated:Bool){
2
super.viewWillAppear(animated)
3
4
updateTileFetchMode()
5
NGLRegionalOffline.onMapViewWillAppear()
6
}
Refresh explicitly after returning from the download page:
When regionalOfflineTileFetchCacheOnly is true, the map reads from shared preview resources and installed regional databases instead of requesting regional tiles online.
Focus the map on an installed region
1
let focused =NGLRegionalOffline.focusPreviewRegion(
2
with: mapView,
3
regionId: regionId
4
)
5
6
if!focused {
7
// No usable database or bounds were found for this region.