v11.0.0
mapbox-github-ci-writer-public-1
released this
29 Nov 20:50
·
365 commits
to main
since this release
Mapbox Maps SDK iOS v11 enables the Mapbox Standard Style, a new realistic 3D lighting system, building shadows and many other visual enhancements, Swift UI support, an updated ergonomic API for working with map styles and custom data, and much more! You can learn about each new feature and how to upgrade in the Migration guide. Additionally, be sure to check out our topic-by-topic documentation on our Docs website.
v11.0.0
Features ✨ and improvements 🏁
Map Styles - Documentation & Migration Guide
- Introduce the Mapbox Standard Style as the default style
- Expose new APIs for working with style importing and configuration: getStyleImports(), removeStyleImport(forImportId:), getStyleImportSchema(forImportId:), getStyleImportConfigProperties(forImportId:), setStyleImportConfigPropertiesForImportId(:configs:), getStyleImportConfigProperty(forImportId:config:), setStyleImportConfigPropertyForImportId(:config:value:)
- Introduce
Slot
struct with static properties to manage adding layers to pre-specified slots in a style import. See documentation here. - Refactor
MapboxMap.loadStyle
to cancel previous style loads when called multiple times. - New experimental
StyleManager.load(mapStyle:transition:completion)
method to loadMapStyle
inMapboxMap
, orSnapshotter
:mapboxMap.load(mapStyle: .standard(lightPreset: .dawn, showRoadLabels: false)) { _ in print("Style is loaded") }
- Add "keep-legacy-style-pack" style pack load extra option that prevents from the style package removal from the legacy storage
- Relax style parsing of an unknown style layer properties
StyleColor
- add support for all color formats as defined by Mapbox Style Spec.- Add required
id
property toSource
. After that changeid
should be specified for source upon creation:let terrainSource = RasterDemSource(id: "terrain-source") mapView.mapboxMap.addSource(terrainSource)
- Support string option in
GeoJSONSourceData
. - Allows passing
extraOptions
(which must be a valid JSON object) when creatingStylePackLoadOptions
andTilesetDescriptorOptions
. - Deprecate
MapboxMap/style
andSnapshotter/style
, from now on you can access Style APIs directly fromMapboxMap
andSnapshotter
instance.
Swift UI - Documentation & Migration Guide
Note: SwiftUI support is an experimental feature, its API may be changed until it stabilizes.
In v11 our approach to Swift UI has been updated significantly. Please see our Swift UI documentation here to get started.
- To enable or disable
safeAreaInsets
when calculating a camera's padding in every viewport, you can useMap.usesSafeAreaInsetsAsPadding(_:)
, additionally, you can add extra global safe area insets to the map using modifierMap.additionalSafeAreaInsets
- Use
MapViewAnnotation
instead ofViewAnnotation
to display view annotations in SwiftUI.Map { MapViewAnnotation(coordinate: coordinate) { Text("🏠") } .allowOverlap(false) .variableAnchors([ViewAnnotationAnchorConfig(anchor: .bottom)]) }
- Annotation groups can be created with static list of annotations. In the example below polyline annotation group displays two annotations on the same layer.
Map {
PolylineAnnotationGroup {
PolylineAnnotation(lineCoordinates: route.coordinates)
.lineColor("blue")
if let alternativeRoute {
PolylineAnnotation(lineCoordinates: alternativeRoute.coordinates)
.lineColor("green")
}
}
.lineCap(.round)
.slot("middle")
}
Map Events - Migration Guide
- Map events have been reworked:
- Now all Map events payloads are serialize-free, which brings more type safety and eliminates possible deserialization errors;
- The
MapboxMap
andSnapshotter
now exposeon
-prefixed properties that allows you to subscribe to map events viaobserve
andobserveNext
methods:mapboxMap.onCameraChanged.observe { [weak self] event in self?.camera = event.cameraState }.store(in: &cancelables) mapboxMap.onStyleLoaded.observeNext { [weak self] _ in self?.configureStyle() }.store(in: &cancelables)
- The
AnyCancelable
object returned fromobserve
andobserveNext
should be stored, otherwise the subscription will be immediately canceled; - The same
on
-prefixed properties can now be used asCombine.Publisher
:import Combine mapboxMap.onCameraChanged .debounce(for: .milliseconds(500), scheduler: DispatchQueue.main) .map(\.cameraState) .sink { [weak self] cameraState in self?.camera = cameraState }.store(in: &cancellables)
- Methods
MapboxMap.onEvery
,MapboxMap.onNext
,Snapshotter.onEvery
,Snapshotter.onNext
have been deprecated; - Methods
MapboxMap.observe
andSnapshotter.observe
have been removed.
Lights - Migration Guide
- Enable rendering of fill extrusion flood lights on the ground with fully transparent fill extrusions
- Align hillshade illumination direction with 3d lights
- Flood lighting and AO ground contribution in draped mode
- Increase rendering performance of shadows
- Refactor style Light API: introduce
AmbientLight
,DirectionalLight
,FlatLight
and methods to set them. - Introduce
hsl
,hsla
,random
expressions. - Introduce
measureLight
expression lights configuration property. - Introduce experimental
BackgroundLayer/backgroundEmissiveStrength
,CircleLayer/circleEmissiveStrength
,FillLayer/fillEmissiveStrength
,LineLayer/lineEmissiveStrength
,SymbolLayer/iconEmissiveStrength
,SymbolLayer/textEmissiveStrength
,ModelLayer/modelEmissiveStrength
,ModelLayer/modelRoughness
,ModelLayer/modelHeightBasedEmissiveStrengthMultiplier
APIs. - Introduce experimental
FillExtrusionLayer/fillExtrusionAmbientOcclusionWallRadius
,FillExtrusionLayer/fillExtrusionAmbientOcclusionGroundRadius
,FillExtrusionLayer/fillExtrusionAmbientOcclusionGroundAttenuation
,FillExtrusionLayer/fillExtrusionFloodLightColor
,FillExtrusionLayer/fillExtrusionFloodLightIntensity
,FillExtrusionLayer/fillExtrusionFloodLightWallRadius
,FillExtrusionLayer/fillExtrusionFloodLightGroundRadius
,FillExtrusionLayer/fillExtrusionFloodLightGroundAttenuation
,FillExtrusionLayer/fillExtrusionVerticalScale
APIs. - Introduce
FillExtrusionLayer.fillExtrusionRoundedRoof
,FillExtrusionLayer.fillExtrusionEdgeRadius
API. - Introduce
lineDepthOcclusionFactor
API forLineLayer
s andPolylineAnnotiationManager
.
GeoJSON and Query Rendered Features
- Expose new Style APIs for partial GeoJSON update:
MapboxMap.addGeoJSONSourceFeatures(forSourceId:features:dataId:)
MapboxMap.updateGeoJSONSourceFeatures(forSourceId:features:dataId:)
MapboxMap.removeGeoJSONSourceFeatures(forSourceId:featureIds:dataId:)
- Different data types are now used for
querySourceFeatures
andqueryRenderedFeatures
:QueriedSourceFeature
andQueriedRenderedFeature
.QueriedRenderedFeature
has a new fieldlayer
which contains the queried feature's layer id. - Remove deprecated
queryRenderedFeatures()
methods. UsequeryRenderedFeatures(with:options:completion:)
instead. - Remove deprecated
queryFeatureExtension()
method. UsegetGeoJsonClusterLeaves()
/getGeoJsonClusterChildren()
/getGeoJsonClusterExpansionZoom()
instead. - Add the
MapboxMap.resetFeatureState
method. - Add
callback
argument to theMapboxMap
methodsgetFeatureState
,setFeatureState
,removeFeatureState
. - Return
cancelable
from theMapboxMap
methods :getFeatureState
,setFeatureState
,removeFeatureState
,querySourceFeatures
,getGeoJsonClusterLeaves
,getGeoJsonClusterChildren
,getGeoJsonClusterExpansionZoom
.
Annotations - Documentation
- Introduce new Map Content Gesture System, please refer to Map Content Gestures Guide for more information and guidance.
- Added
allowOverlapWithPuck
andignoreCameraPadding
options toViewAnnotation
andMapViewAnnotation
. - Support
slot
for annotation managers and annotation groups. - New ViewAnnotation class is added to simplify work with view annotations, use it instead of
ViewAnnotationOptions
. - Support for Dynamic View Annotations. Use them to attach View annotations to any feature rendered by map, for example you can visualize additional information along the routes, areas, or points. The annotations will reposition themselves when user pans the map. Check the ViewAnnotation and MapViewAnnotation documentation or the pre-built DynamicViewAnnotationExample.
Camera Documentation & Migration Guide
- Add
MapboxMaps.camera(for:camera:coordinatesPadding:maxZoom:offset)
. - Add
cameraForCoordinates
overload so that the padding for map & geometry can be specified separately. - Improve map camera and gestures when terrain is used to fix camera bumpiness and map flickering.
- Fix bearing value is fluctuating between initial value and correct value during a rotation gesture.
- Allow zoom and animation during any ongoing gestures.
- Expose
owner
property forCameraAnimator
protocol
Token Management - Migration Guide
- Remove
ResourceOptions
andResourceOptionsManager
. IntroduceMapboxOptions
andMapboxMapsOptions
to handle application-level access token and other generic options.- Mapbox's access token can now be set with
MapboxCommon.MapboxOptions
. By default, MapboxMaps SDK will try to read the access token from app bundle's property list orMapboxAccessToken
file when Maps service are initialized; if you wish to set access token programmatically, it is highly recommended to set it before initializing aMapView
.import MapboxMaps MapboxOptions.accessToken = accessToken
TileStore
no longer requiresTileStoreOptions.mapboxAccessToken
to be explicitly set.- Configurations for the external resources used by Maps API can now be set with
MapboxMapsOptions
:import MapboxMaps MapboxMapsOptions.dataPath = customDataPathURL MapboxMapsOptions.assetPath = customAssetPathURL MapboxMapsOptions.tileStoreUsageMode = .readOnly MapboxMapsOptions.tileStore = tileStore
- To clear the temporary map data, you can use
MapboxMap.clearData(completion:)
- Mapbox's access token can now be set with
Other new features and updates
- Add
MapViewDebugOptions.padding
debug option. - Add
maxZoom
andoffset
parameters toOverviewViewportStateOptions
. - Add support for glb 3d tiles
- Add a new CustomLayer API to simplify manipulation of layers with custom rendering (aka "CustomLayerHost").
- The following APIs have been promoted to stable:
LineLayer/lineDepthOcclusionFactor
,LineLayer/lineDepthOcclusionFactorTransition
,LineLayer/lineEmissiveStrength
andLineLayer/lineEmissiveStrengthTransition
SymbolLayer/iconImageCrossFade
,SymbolLayer/iconImageCrossFadeTransition
,SymbolLayer/iconEmissiveStrength
,SymbolLayer/iconEmissiveStrengthTransition
,SymbolLayer/textEmissiveStrength
andSymbolLayer/textEmissiveStrengthTransition
BackgroundLayer/backgroundEmissiveStrength
andBackgroundLayer/backgroundEmissiveStrengthTransition
CircleLayer/circleEmissiveStrength
andCircleLayer/circleEmissiveStrengthTransition
FillLayer/fillEmissiveStrength
andFillLayer/fillEmissiveStrengthTransition
AmbientLight
,DirectionalLight
and related APIs.
- Add MSAA support with the
MapInitOptions/antialiasingSampleCount
property. - Introduce experimental Custom Raster Source APIs:
StyleManager/addCustomRasterSource
,StyleManager/setCustomRasterSourceTileData
,StyleManager/invalidateCustomRasterSourceTile
,StyleManager/invalidateCustomRasterSourceRegion
. - Expose a method to remove tile region with a completion:
TileStore.removeTileRegion(forId:completion:)
. - Introduce experimental
MapboxRecorder
, which allows recording of the map and replaying custom scenarios. - Add privacy policy attribution dialog action.
- Show SDK version in the attribution dialog title.
- Introduce
LineLayer/lineBorderColor
,LineLayer/lineBorderWidth
APIs. - Introduce
SymbolLayer/iconImageCrossFade
API. - Add experimental
tileCover
method to theSnapshotter
that returns tile ids covering the map. - Add optional
maxZoom
andoffset
parameters toMapboxMap.camera(for coordinateBounds:)
.MapboxMap.camera(for coordinateBounds:)
,MapboxMap.camera(for coordinates:)
, andMapboxMap.camera(for geometry:)
no longer return a padding value. - Mark
Expression.Operator.activeAnchor
as experimental. - Add transition options as a parameter to
loadStyle(...)
methods. - Add
MapboxMap.coordinate(s)Info(for:)
for converting offscreen points into geographical coordinates. - Remove
source
,sourceLayer
,filter
properties from theLayer
protocol requirement. - Add expression support to
Layer.visibility
. - Convert Style properties enums into structs.
- Make NSNumber extension internal.
- Add
rotation
case toGestureType
to be able to detect rotation separately from other gestures. - Sync map size to the size of the metal view.
- Bumped min iOS version to 12.0
SourceType
,LayerType
,TypeConversionError
,SnapshotError
, andViewAnnotationManagerError
are now structs with static variables instead of enums- Add a new API to enable Tracing with
Tracing.status = .enabled
. CheckoutTracing
reference to see more. - Add
Codable
support toCameraOptions
,CameraState
,FollowPuckViewportStateBearing
,FollowPuckViewportStateOptions
.
Optimizations
- Skip location and bearing updates if new value changes are under fixed epsilon
- Disable terrain when zoom-dependent exaggeration expression evaluates to zero.
- Improve the caching model for the Custom Raster Source.
- Optimize Custom Raster source data update
- Optimize memory usage in the fill-extrusion layer
- Improve the rendering performance of a symbol layer that uses symbol-sort-key property
- Reduce memory usage in fill-extrusion flood light and ground ambient occlusion
- Remove MetaKit reexport.
- Remove unnecessary check before updating a geo json source.
- Merge
TilesetDescriptorOptions
andTilesetDescriptorOptionsForTilesets
. To enable tileset descriptor creation for a list of tilesets that are not part of the original style useTilesetDescriptorOptions
. - Use
DataRef
to pass snapshot and style image data by reference, improving performance
Breaking changes ⚠️
MapboxMap.loadStyle
methods changed error type fromMapLoadingError
toError
.OverviewViewportStateOptions.coordinatesPadding
is renamed toOverviewViewportStateOptions.geometryPadding
.- Bearing indication on user location puck is disabled by default to reduce amount map redraws.
To re-enable bearing update rendering, setmapView.location.options.puckBearingEnabled
totrue
. - The default behavior of resetting the viewport to idle is changed. Previously viewport was reset to idle when the user touched the map for longer than 150 ms. Now it will happen when the user pans the map. If the desired behavior is different, you can disable the default by setting
mapView.viewport.options.transitionsToIdleUponUserInteraction
tofalse
and implementing any gesture that callsmapView.viewport.idle()
. - Style projection can be undefined for styles that do not explicitly specify it, so
MapboxMap.projection
has become optional. - View Annotation API is changed:
ViewAnnotationOptions.geometry
was removed in favor ofViewAnnotationOptions.annotatedFeature
.ViewAnnotationOptions.associatedFeatureId
was removed. UseAnnotatedFeature.layerFeature(layerId:featureId:)
withViewAnnotationOptions.annotatedFeature
to bind View Annotation to features rendered by any layer.
OverviewViewportStateOptions.padding
is renamed toOverviewViewportStateOptions.coordinatePadding
, theOverviewViewportStateOptions.padding
now represents the camera padding.- Consolidate
FetchTileFunctionCallback
andCancelTileFunctionCallback
by single typeTileFunctionCallback
. StyleColor.red
,StyleColor.green
,StyleColor.blue
,StyleColor.alpha
are not in use anymore and got removed.- The
syncSourceAndLayerIfNeeded
method in every annotation manager (e.gPointAnnotationManager
and others) was removed from the public API. MapboxMap.dragStart()
andMapboxMap.dragEnd()
are not in use anymore and were removed.- Remove
MapOptions.optimizeForTerrain
option. Whenever terrain is present layer order is automatically adjusted for better performance. - Rename
Viewport
toViewportManager
to reserveViewport
for SwiftUI API. - Apply
ModelScaleMode.viewport
to Puck3D configuration and remove the custom expression for themodelScale
of the puck. This means if you are using a constant forPuck3DConfiguration.modelScale
in v10, you need to adjust this model-scale constant so the puck would be rendered correctly in v11, while this value depends on other configurations of your puck, we have found the new adjusted model-scale to fall between 10x-100x of the old value. Location
is split intoLocation
andHeading
structs, the location and heading data are now animated individually.- Replace
loadStyleJSON(_:completion:)
/loadStyleJSON(_:completion:)
with overloadedloadStyle(_:completion:)
. Expression.Operator
is now a struct with static variables instead of enum.- Remove deprecated
LocationManager.updateHeadingForCurrentDeviceOrientation()
method. - Remove deprecated
MapEvents.EventKind
. - Remove experimental
MapboxMap.setRenderCache(_:)
method. - Remove deprecated
GestureOptions.pinchRotateEnabled
. - Remove deprecated
Location
initializer. - Remove deprecated transition properties from layers.
- Make
easeTo/flyTo
return non-optional cancelable token. - Protocol
LocationProvider
now requires class semantic for implementation. - Deprecate
PointAnnotationManager.iconTextFit
andPointAnnotationManager.iconTextFitPadding
in favor ofPointAnnotation.iconTextFit
andPointAnnotation.iconTextFitPadding
. - Remove deprecated
PuckBearingSource
and related APIs. - Experimental API
MapboxMap/setMemoryBudget
was renamed toMapboxMaps/setTileCacheBudget
and promoted to stable. LocationConsumer
andPuckLocationConsumer
are removed. Instead, useLocationManager.onLocationChange
/LocationManager.onHeadingChange
andLocationManager.onPuckRender
to observe location events.
Bug fixes 🐞
- Fix issue where 2D puck images are not getting updates.
- Fixed issue when quick interaction didn't lead to resetting viewport to
idle
. - Fix issue when transition to Overview Viewport resulted in double padding.
- Improve handling of inlined style fragments
- Do not overwrite style URL when setting invalid style JSON
- Don't store SDK version in TileStore
- Fix a bug where the map would not zoom above a certain threshold on high-pitched views
- Fix crashes if 3D layers are used alone on terrain or globe without any other layer types
- Fix line layer leaking if placed behind the satellite layer
- Fix line and raster layers interop for draped mode
- Fix a crash problem that occurred when consecutive snapshot requests were made
- Correct half-texel misalignment in raster-color lookup texture sampling
- Use the system's default fraction digit setting for currency formatting
- Fix erroneous shadow map sampling of distant landmarks
- Fix incorrect level-of-detail model being chosen for trees in some scenarios
- Fix the style layer minimum and maximum zoom dfault values
- Fix
modelCastShadows
andmodelReceiveShadows
options ofPuck3DConfiguration
being ignored. - Fixed an issue when
MapboxMap.point(for:)
could return false negative result. - Fix missing feature properties for
nil
/null
values. - [Swift UI] Fixed a bug when
Viewport.inset(...)
didn't use safe area insets on the first load. - [Swift UI] Fixed a map basic coordinator clinging to the first subscriptions.
- [Swift UI] Fixed issue when viewport inset with safe area is calculated incorrectly.
- [Swift UI] Fixed an issue when Overview Viewport is incorrect if set as initial viewport.
Dependencies
- Update MapboxCommon to
24.0.0
. - Update MapboxCoreMaps to
11.0.0
:
Changelog
Features ✨ and improvements 🏁
- Added
allowOverlapWithPuck
andignoreMapPadding
flags toViewAnnotationOptions
. - The SDK now avoids placing view annotations on overlapped line geometries if the current bound layer is below other annotated line layers.
- Add properties to control fade out of model and fill-extrusion layers when pitch is used
- Improve fog rendering performance
- Add
getCenterAltitudeMode
function to the public API. - Improve fill layer and model layer rendering performance on high pitch views.
- Add custom raster source API to support custom raster tiles generated/provided by the client.
- Improve GPU performance by drawing opaque 3D geometry without blending
- Introduce experimental symbol-z-elevate property to elevate symbols along with the buildings that are in the same place. The feature is supported for symbols with point placement only.
- Add vertical-range property for fog
- Use a fallback glyph URL if a style does not define one. This enables the addition of Symbol layers to an empty style or to the style that doesn't use Symbol layers.
- Use ETC2 compression for raster tiles to support transparency.
- Add runtime styling API.
- Reduce segment overlap in flood lighting to improve rendering performance
- Enable offline support for the Standard style
- Reduce vertex buffer size in flood lighting and ground AO when rounded edges are enabled to improve performance
- Add wireframe rendering debug feature (note: only supported on Android at the moment)
Bug fixes 🐞
- Fixed flickering and wrong positions for elevated symbols.
- Updating a style layer's source will now trigger repaint.
- Fixed issue where model loading might have failed when the model used a 32-bit index buffer.
- Fixed rendering of the updated content on the map after a feature state change if terrain or globe were enabled.
- Fixed issue where view annotations would disappear on the upper parts of the screen when terrain was enabled.
- The SDK now triggers view annotation replacement if the associated layer/source gets changed.
- Fixed a bug where snapshot is rendered without 3D content.
- Fix the line label flickering issue by eliminating the anchor rounding error
- Honor model-emissive-strength for 3D location indicator
- Fix rendering of large/complex fill extrusion features
- Fix issue where the terrain didn't work if defined within a style fragment
- The Custom Geometry Source
fetchTileFunction()
andcancelTileFunction()
callbacks are invoked on the client thread. - Fixes a rendering error that broke symbol layers on Samsung S22 devices
- Cache featureState for newly added source in case it is not available in renderer
- Fix issue with model layer blending with geometry tile source
- Fix incorrectly set begin timestamp for the RenderFrameFinished event
- Fix fallback rules for the style's transition property. The change fixes style transitions when style imports are modified for the Standard style.
- Improve camera behavior on terrain. This change fixes jumpy camera animations on platforms.
- Fix a crash on application exit when multiple maps were rendered in a single thread.
- Fix terrain rendering for the Terrarium-encoded tiles.
- Fixes an issue that causes view annotations to be placed on the sky when high pitch and mercator projection is used.
- Fix race condition for Metal library initialization. The fix allows developers to create multiple MapSnapshotter instances without hitting race condition that raises an exception and terminates the application.
- Fix Tileset descriptor resolving on network error. The issue prevented the downloading of style and tilepacks in case of a network error.
- Avoid excessive relayout of the symbol layer when no properties depend on the image changes. This fix eliminates the symbol layer flickering when styles are switched.
- Don't emit MapLoadingError if an offline tilepack for 3D landmarks has no tiles
- Fix a bug where the cameraForGeometry method returned incorrect values for the globe projection
Dependency requirements:
- Compatible version of Xcode:
14.1.0