Skip to content

Commit

Permalink
[MAPSIOS-1403] Expose allSlotIdentifiers in StyleManager (#2125)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksproger authored Apr 23, 2024
1 parent 02ab36e commit c1894d7
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion MapboxMaps.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Pod::Spec.new do |m|
m.source_files = 'Sources/MapboxMaps/**/*.{swift,h}'
m.resource_bundles = { 'MapboxMapsResources' => ['Sources/**/*.{xcassets,strings}', 'Sources/MapboxMaps/MapboxMaps.json', 'Sources/MapboxMaps/PrivacyInfo.xcprivacy'] }

m.dependency 'MapboxCoreMaps', '11.4.0-SNAPSHOT.0417T1228Z.b5204fc'
m.dependency 'MapboxCoreMaps', '11.4.0-SNAPSHOT.0422T0943Z.e5a8c75'
m.dependency 'MapboxCommon', '24.3.1'
m.dependency 'Turf', '2.8.0'

Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import PackageDescription
import Foundation

let coreMaps = MapsDependency.coreMaps(version: "11.4.0-SNAPSHOT.0417T1228Z.b5204fc", checksum: "5ad1d2c4f0e027bb23b149784dac08c14ac9d9f19f9e8a972e34fd809d188da9")
let coreMaps = MapsDependency.coreMaps(version: "11.4.0-SNAPSHOT.0422T0943Z.e5a8c75", checksum: "feb71b4e2d1d1da16fdf994fddbf2daf2eed92afad8047795fd10b5ce8a0f575")
let common = MapsDependency.common(version: "24.3.1")

let mapboxMapsPath: String? = nil
Expand Down
6 changes: 6 additions & 0 deletions Sources/MapboxMaps/Style/StyleManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,12 @@ public class StyleManager {
return styleManager.styleLayerExists(forLayerId: id)
}

/// The ordered list of the current style slots identifiers
@_spi(Experimental)
public var allSlotIdentifiers: [Slot] {
styleManager.getStyleSlots().compactMap(Slot.init)
}

/// The ordered list of the current style layers' identifiers and types
public var allLayerIdentifiers: [LayerInfo] {
styleManager.getStyleLayers().map { info in
Expand Down
1 change: 1 addition & 0 deletions Sources/MapboxMaps/Style/StyleManagerProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ internal protocol StyleManagerProtocol {

func styleLayerExists(forLayerId layerId: String) -> Bool
func getStyleLayers() -> [MapboxCoreMaps.StyleObjectInfo]
func getStyleSlots() -> [String]

func getStyleLayerProperty(forLayerId layerId: String, property: String) -> MapboxCoreMaps.StylePropertyValue

Expand Down
5 changes: 5 additions & 0 deletions Tests/MapboxMapsTests/Foundation/Mocks/MockStyleManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ class MockStyleManager: StyleManagerProtocol {
getStyleLayersStub.call()
}

let getStyleSlotsStub = Stub<Void, [String]>(defaultReturnValue: [])
func getStyleSlots() -> [String] {
getStyleSlotsStub.call()
}

typealias GetStyleLayerPropertyParameters = (layerID: String, property: String)
let getStyleLayerPropertyStub = Stub<GetStyleLayerPropertyParameters, StylePropertyValue>(
defaultReturnValue: StylePropertyValue(value: "foo", kind: .undefined)
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/packager/versions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"MapboxCoreMaps": "11.4.0-SNAPSHOT.0417T1228Z.b5204fc",
"MapboxCoreMaps": "11.4.0-SNAPSHOT.0422T0943Z.e5a8c75",
"MapboxCommon": "24.3.1",
"Turf": "2.8.0"
}

0 comments on commit c1894d7

Please sign in to comment.