Skip to content

Mapbox MapViewHolder

MapboxViewState.getMapViewHolder() returns AnyMapViewHolder?. The native view can be cast to Mapbox’s MapView; holder.map can be cast to MapboxMap.

import MapboxMaps
if let holder = mapViewState.getMapViewHolder(),
let mapView = holder.mapView as? MapView {
mapView.mapboxMap.setCamera(
to: CameraOptions(
center: CLLocationCoordinate2D(latitude: 35.6812, longitude: 139.7671),
zoom: 14
)
)
}