Base-Map Theme (Light / Dark)
The SDK renders an outdoor base map underneath your indoor property. In 26.7.1 you can set that base map's theme — light, grey, or dark — so it matches the rest of your app, and switch it automatically when the user toggles iOS Dark Mode.
Availability
New in iOS SDK 26.7.1. The base-map style API is on MapstedMapApi, available from import MapstedMap.
The styles
MapstedMapMeta.BaseMapStyle has four cases:
| Case | Appearance |
|---|---|
.LIGHT |
Light base map |
.GREY |
Muted / grey base map |
.DARK |
Dark base map |
.DEFAULT |
The SDK default (light) |
Setting the style
Call setBaseMapStyle(style:) on the shared MapstedMapApi:
import com.mapsted.map.MapApi;
import com.mapsted.map.models.layers.BaseMapStyle;
// Apply a dark base map at runtime
mapApi.mapView().config().applyMapStyle(BaseMapStyle.DARK, context);
// Read the current style: BaseMapStyle.DEVICE_DEFAULT, LIGHT, DARK, or GREY
int current = mapApi.mapView().config().getMapStyle();
import MapstedMap
// Apply a dark base map
MapstedMapApi.shared.setBaseMapStyle(style: .DARK)
// Read the current style
let current = MapstedMapApi.shared.getBaseMapStyle()
Following the system appearance
To keep the base map in step with iOS Light/Dark Mode, ask the SDK for the style that matches the current appearance and apply it — both at startup and whenever the trait collection changes:
import com.mapsted.map.MapApi;
import com.mapsted.map.models.layers.BaseMapStyle;
// DEVICE_DEFAULT follows the system Light/Dark setting automatically.
mapApi.mapView().config().applyMapStyle(BaseMapStyle.DEVICE_DEFAULT, context);
// Or resolve the concrete style for the current configuration and apply it,
// e.g. from Activity.onConfigurationChanged when night mode changes:
int style = BaseMapStyle.getBaseMapStyle(context, BaseMapStyle.DEVICE_DEFAULT);
mapApi.mapView().config().applyMapStyle(style, context);
import UIKit
import MapstedMap
final class MapContainerViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
applyAppearanceMatchedBaseMap()
}
override func traitCollectionDidChange(_ previous: UITraitCollection?) {
super.traitCollectionDidChange(previous)
if traitCollection.userInterfaceStyle != previous?.userInterfaceStyle {
applyAppearanceMatchedBaseMap()
}
}
private func applyAppearanceMatchedBaseMap() {
// Returns .DARK in dark mode, otherwise .DEFAULT (light).
let style = MapstedMapMeta.getStyleForCurrentAppearance()
MapstedMapApi.shared.setBaseMapStyle(style: style)
}
}
getStyleForCurrentAppearance() returns .DARK when the current trait collection is in dark mode and .DEFAULT otherwise, so the base map follows the same light/dark mode as your navigation UI — resolving the light-map / dark-nav mismatch.
Tips & Considerations
- Call
setBaseMapStyle(style:)after the map is set up. The style applies to the live map; set it once the map API is initialized, then again on appearance changes. getStyleForCurrentAppearance()only distinguishes dark from light — it returns.DARKor.DEFAULT. UsesetBaseMapStyle(style: .GREY)directly if you want the grey theme regardless of system appearance.- The style affects only the outdoor base map, not your indoor property/building layers (those follow your style asset — see Self-Hosted Basemap).