Skip to content

Commit 29ee078

Browse files
evil159actions-user
authored andcommitted
[gl-native][maps-ios] Move Swift bindings for LayerPosition and Image (#2700)
Co-authored-by: Changelog autocreator bot <[email protected]> GitOrigin-RevId: 9cb7b16cfdb4c19dd4ec3720c0025518e67c98be
1 parent 78910b8 commit 29ee078

File tree

9 files changed

+37
-59
lines changed

9 files changed

+37
-59
lines changed

MapboxMaps.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ Pod::Spec.new do |m|
2121
m.source_files = 'Sources/MapboxMaps/**/*.{swift,h}'
2222
m.resource_bundles = { 'MapboxMapsResources' => ['Sources/**/*.{xcassets,strings}', 'Sources/MapboxMaps/MapboxMaps.json', 'Sources/MapboxMaps/PrivacyInfo.xcprivacy'] }
2323

24-
m.dependency 'MapboxCoreMaps', '11.11.0-beta.1'
25-
m.dependency 'MapboxCommon', '24.11.0-beta.1'
24+
m.dependency 'MapboxCoreMaps', '11.11.0-SNAPSHOT-03-20--06-47.git-443decb'
25+
m.dependency 'MapboxCommon', '24.11.0-SNAPSHOT-03-20--06-47.git-443decb'
2626
m.dependency 'Turf', '4.0.0'
2727

2828
end

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import PackageDescription
55
import Foundation
66

7-
let coreMaps = MapsDependency.coreMaps(version: "11.11.0-beta.1")
7+
let coreMaps = MapsDependency.coreMaps(version: "11.11.0-SNAPSHOT-03-20--06-47.git-443decb", checksum: "81d1f50eef76fac7218a7cd232b7a2ac98db65d142ede5de3c7d9504c6da9d07")
88

9-
let common = MapsDependency.common(version: "24.11.0-beta.1")
9+
let common = MapsDependency.common(version: "24.11.0-SNAPSHOT-03-20--06-47.git-443decb", checksum: "bfeb77f0472423b68844da907b2a70958856230d56864ce5f7f953b2abdd402e")
1010

1111
let mapboxMapsPath: String? = nil
1212

Sources/MapboxMaps/ContentBuilders/MapStyleContent/MapStyleMountedComponents.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os.log
2+
@_spi(Marshalling) import MapboxCoreMaps
23

34
struct MountedLayer<L>: MapContentMountedComponent where L: Layer, L: Equatable {
45
var layer: L
@@ -13,18 +14,19 @@ struct MountedLayer<L>: MapContentMountedComponent where L: Layer, L: Equatable
1314
let styleManager = context.style.styleManager
1415
let properties = try layer.allStyleProperties()
1516
let position = customPosition ?? context.resolveLayerPosition()
17+
let corePosition: CoreLayerPosition = LayerPosition.Marshaller.toObjc(position)
1618
os_log(.debug, log: .contentDSL, "layer %s insert %s", layer.id, position.asString())
1719

1820
if let customLayer = layer as? CustomLayer {
1921
try handleExpected {
20-
styleManager.addStyleCustomLayer(forLayerId: customLayer.id, layerHost: customLayer.renderer, layerPosition: position.corePosition)
22+
styleManager.addStyleCustomLayer(forLayerId: customLayer.id, layerHost: customLayer.renderer, layerPosition: corePosition)
2123
}
2224
try handleExpected {
2325
styleManager.setStyleLayerPropertiesForLayerId(layer.id, properties: properties)
2426
}
2527
} else {
2628
try handleExpected {
27-
styleManager.addStyleLayer(forProperties: properties, layerPosition: position.corePosition)
29+
styleManager.addStyleLayer(forProperties: properties, layerPosition: corePosition)
2830
}
2931
}
3032
}
@@ -66,7 +68,7 @@ struct MountedLayer<L>: MapContentMountedComponent where L: Layer, L: Equatable
6668
let position = customPosition ?? context.resolveLayerPosition()
6769
os_log(.debug, log: .contentDSL, "layer %s move to %s", layer.id, position.asString())
6870
try handleExpected {
69-
styleManager.moveStyleLayer(forLayerId: layer.id, layerPosition: position.corePosition)
71+
styleManager.moveStyleLayer(forLayerId: layer.id, layerPosition: LayerPosition.Marshaller.toObjc(position))
7072
}
7173

7274
return true

Sources/MapboxMaps/Documentation.docc/API Catalogs/Style.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- ``Snow``
3131
- ``ColorTheme``
3232
- ``ColorUseTheme``
33+
- ``Image``
3334

3435
### Declarative Map Styling
3536

Sources/MapboxMaps/Foundation/CoreAliases.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ typealias CoreCameraBoundsOptions = MapboxCoreMaps_Private.CameraBoundsOptions
88
typealias CoreMapSnapshotOptions = MapboxCoreMaps_Private.MapSnapshotOptions
99
typealias CoreMapSnapshot = MapboxCoreMaps_Private.MapSnapshot
1010
typealias CoreViewAnnotationOptions = MapboxCoreMaps_Private.ViewAnnotationOptions
11-
typealias CoreLayerPosition = MapboxCoreMaps_Private.LayerPosition
11+
typealias CoreLayerPosition = MapboxCoreMaps_Private.__LayerPosition
1212
typealias CoreImportPosition = MapboxCoreMaps_Private.ImportPosition
1313
typealias CoreTracing = MapboxCoreMaps_Private.Tracing
1414
typealias CoreAnnotatedFeature = MapboxCoreMaps_Private.AnnotatedFeature
@@ -19,7 +19,7 @@ typealias CoreScreenCoordinate = MapboxCoreMaps_Private.ScreenCoordinate
1919
typealias CoreScreenBox = MapboxCoreMaps_Private.ScreenBox
2020
typealias CoreEdgeInsets = MapboxCoreMaps_Private.EdgeInsets
2121
typealias CoreTileCoverOptions = MapboxCoreMaps_Private.TileCoverOptions
22-
typealias CoreMapsImage = MapboxCoreMaps_Private.Image
22+
typealias CoreMapsImage = MapboxCoreMaps_Private.__Image
2323
typealias CoreCustomRasterSourceTileData = MapboxCoreMaps_Private.CustomRasterSourceTileData
2424
typealias CoreStyleManager = MapboxCoreMaps_Private.StyleManager
2525
typealias CoreGeoJSONSourceData = MapboxCoreMaps_Private.GeoJSONSourceData

Sources/MapboxMaps/Foundation/Extensions/Core/LayerPosition.swift

Lines changed: 0 additions & 43 deletions
This file was deleted.

Sources/MapboxMaps/Style/StyleManager.swift

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// swiftlint:disable file_length
22
@_implementationOnly import MapboxCommon_Private
33
import UIKit
4+
@_spi(Marshalling) import MapboxCoreMaps
45

56
protocol StyleProtocol: AnyObject {
67
var isStyleLoaded: Bool { get }
@@ -641,7 +642,10 @@ public class StyleManager {
641642
/// An error describing why the operation was unsuccessful.
642643
public func addLayer(with properties: [String: Any], layerPosition: LayerPosition?) throws {
643644
try handleExpected {
644-
return styleManager.addStyleLayer(forProperties: properties, layerPosition: layerPosition?.corePosition)
645+
return styleManager.addStyleLayer(
646+
forProperties: properties,
647+
layerPosition: layerPosition.map(LayerPosition.Marshaller.toObjc)
648+
)
645649
}
646650
}
647651

@@ -655,7 +659,7 @@ public class StyleManager {
655659
/// `StyleError` on failure, or `NSError` with a _domain of "com.mapbox.bindgen"
656660
public func moveLayer(withId id: String, to position: LayerPosition) throws {
657661
try handleExpected {
658-
styleManager.moveStyleLayer(forLayerId: id, layerPosition: position.corePosition)
662+
styleManager.moveStyleLayer(forLayerId: id, layerPosition: LayerPosition.Marshaller.toObjc(position))
659663
}
660664
}
661665

@@ -671,7 +675,10 @@ public class StyleManager {
671675
/// An error describing why the operation was unsuccessful
672676
public func addPersistentLayer(with properties: [String: Any], layerPosition: LayerPosition?) throws {
673677
try handleExpected {
674-
return styleManager.addPersistentStyleLayer(forProperties: properties, layerPosition: layerPosition?.corePosition)
678+
return styleManager.addPersistentStyleLayer(
679+
forProperties: properties,
680+
layerPosition: layerPosition.map(LayerPosition.Marshaller.toObjc)
681+
)
675682
}
676683
}
677684

@@ -698,7 +705,11 @@ public class StyleManager {
698705
/// An error describing why the operation was unsuccessful.
699706
public func addPersistentCustomLayer(withId id: String, layerHost: CustomLayerHost, layerPosition: LayerPosition?) throws {
700707
try handleExpected {
701-
return styleManager.addPersistentStyleCustomLayer(forLayerId: id, layerHost: layerHost, layerPosition: layerPosition?.corePosition)
708+
return styleManager.addPersistentStyleCustomLayer(
709+
forLayerId: id,
710+
layerHost: layerHost,
711+
layerPosition: layerPosition.map(LayerPosition.Marshaller.toObjc)
712+
)
702713
}
703714
}
704715

@@ -718,7 +729,11 @@ public class StyleManager {
718729
/// An error describing why the operation was unsuccessful.
719730
public func addCustomLayer(withId id: String, layerHost: CustomLayerHost, layerPosition: LayerPosition?) throws {
720731
try handleExpected {
721-
return styleManager.addStyleCustomLayer(forLayerId: id, layerHost: layerHost, layerPosition: layerPosition?.corePosition)
732+
return styleManager.addStyleCustomLayer(
733+
forLayerId: id,
734+
layerHost: layerHost,
735+
layerPosition: layerPosition.map(LayerPosition.Marshaller.toObjc)
736+
)
722737
}
723738
}
724739

scripts/api-compatibility-check/breakage_allowlist.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,3 +2086,6 @@ Var PolygonAnnotation.fillZOffset is now with @_documentation
20862086
Var PolygonAnnotation.fillZOffset is now with @_spi
20872087
Var PolylineAnnotation.lineZOffset is now with @_documentation
20882088
Var PolylineAnnotation.lineZOffset is now with @_spi
2089+
2090+
# LayerPosition moved to GL Native
2091+
Enum LayerPosition has been removed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"MapboxCoreMaps": "11.11.0-beta.1",
3-
"MapboxCommon": "24.11.0-beta.1",
2+
"MapboxCoreMaps": "11.11.0-SNAPSHOT-03-20--06-47.git-443decb",
3+
"MapboxCommon": "24.11.0-SNAPSHOT-03-20--06-47.git-443decb",
44
"Turf": "4.0.0"
55
}

0 commit comments

Comments
 (0)