Skip to content

v11.4.0-beta.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@mapbox-github-ci-writer-public-1 mapbox-github-ci-writer-public-1 released this 25 Apr 01:25
· 160 commits to main since this release

Changes

⚠️ Known Issues ⚠️

  • In v11.4.0-beta.1, setting a RasterLayer’s rasterColor property with an expression will block the layer from rendering. This issue will be resolved in v11.4.0-rc.1.

Experimental API breaking changes ⚠️

In this release, we introduce the new Declarative Styling API for UIKit and SwiftUI. This change is based on MapContent introduced for SwiftUI; therefore, it has been restructured. The changes are compatible; however, in some rare cases, you may need to adjust your code.

by @persidskiy, @pjleonard37, & @aleksproger

  • [SwiftUI] MapContent now supports custom implementations, similar to SwiftUI views. The MapContent protocol now requires the var body: some MapContent implementation.
  • [SwiftUI] PointAnnotation and Puck3D property-setters that consumed fixed-length arrays reworked to use named properties or platform types for better readability:
// Before
PointAnnotation()
    .iconOffset([10, 20]) // x, y
    .iconTextFitPadding([1, 2, 3, 4]) // top, right, bottom, left
Puck3D()
    .modelScale([1, 2, 3]) // x, y, z

// After
PointAnnotation()
    .iconOffset(x: 10, y: 20)
    .iconTextFitPadding(UIEdgeInsets(top: 1, left: 4, bottom: 3, right: 2))
Puck3D()
    .modelScale(x: 1, y: 2, z: 3)
  • StyleImportConfiguration was removed from public API, the MapStyle now contains the configuration directly.
  • TransitionOptions is now a Swift struct rather than an Objective-C class.

Features ✨ and improvements 🏁

  • All the style primitives can now be used as MapContent in SwiftUI.
@_spi(Experimental) MapboxMaps
Map {
    LineLayer(id: "traffic")
        .lineColor(.red)
        .lineWidth(2)
}

by @aleksproger

  • UIKit applications can now use the setMapStyleContent to use style primitives:
@_spi(Experimental) MapboxMaps
mapView.mapboxMap.setMapStyleContent {
    LineLayer(id: "traffic")
        .lineColor(.red)
        .lineWidth(2)
}

by @persidskiy

  • Allow to assign slot to 2D and 3D location indicators. by @persidskiy
  • Allow observing start/stop event of CameraAnimator. by @maios
    You can observe start/stop event of CameraAnimator by using new CameraAnimationsManager APIs as shown below
    // Observe start event of any CameraAnimator owned by AnimationOwner.cameraAnimationsManager
    mapView.camera
      .onCameraAnimatorStarted
      .owned(by: .cameraAnimationsManager)
      .observe { cameraAnimator in
        // Handle camera animation started here.
      }
      .store(in: &cancelables)
    // Observe finished events of any CameraAnimator
    mapView.camera
      .onCameraAnimatorFinished
      .observe { animator in
        // Handle camera animation stopped here.
      }
      .store(in: &cancelables)
    You can also observe directly on an instance of CameraAnimator when using low-level camera APIs to create a custom animator
    // Declare an animator that changes the map's bearing
    let bearingAnimator = mapView.camera.makeAnimator(duration: 4, curve: .easeInOut) { (transition) in
      transition.bearing.toValue = -45
    }
    bearingAnimator.onStarted.observe {
      // Bearing animator has started.
    }.store(in: &cancelables)
  • Allow adding slots at runtime. by @aleksproger
  • Expose API to interact with style imports using Declarative Styling and regular imperative API. by @aleksproger
  • Expose StyleImport for declarative styling as MapStyleContent. by @aleksproger
  • Expose removeStyleImport, moveStyleImport, updateStyleImport, addStyleImport methods on StyleManager by @aleksproger
  • Allow assigning layerPosition to 2D and 3D location indicators in imperative API. by @aleksproger
  • Make Puck2D and Puck3D to be positioned according to relative layer position in declarative API instead of always top-most position. by @aleksproger
  • Add codesign for XCFrameworks. by @OdNairy
  • MapboxMap.loadStyle() and Snapshotter.loadStyle() now correctly call the completion closure. @persidskiy

Dependencies

Dependency requirements:

  • Compatible version of Xcode: 15.2.0