From 90470d71908daa3f2622f333a9c29d5799878f2e Mon Sep 17 00:00:00 2001 From: PW Date: Thu, 11 Jul 2024 11:58:51 +0200 Subject: [PATCH 1/6] adding more properties, exposing some private marked properties so extensions can be built, improving compatibility with source based features --- .../Style Layers/Circle.swift | 6 +- .../Style Layers/Symbol.swift | 67 ++++++++++++++++--- 2 files changed, 63 insertions(+), 10 deletions(-) diff --git a/Sources/MapLibreSwiftDSL/Style Layers/Circle.swift b/Sources/MapLibreSwiftDSL/Style Layers/Circle.swift index 02d49fa..1094953 100644 --- a/Sources/MapLibreSwiftDSL/Style Layers/Circle.swift +++ b/Sources/MapLibreSwiftDSL/Style Layers/Circle.swift @@ -9,6 +9,7 @@ import MapLibreSwiftMacros @MLNStyleProperty("strokeColor", supportsInterpolation: false) public struct CircleStyleLayer: SourceBoundVectorStyleLayerDefinition { public let identifier: String + public let sourceLayerIdentifier: String? public var insertionPosition: LayerInsertionPosition = .aboveOthers public var isVisible: Bool = true public var maximumZoomLevel: Float? = nil @@ -20,11 +21,13 @@ public struct CircleStyleLayer: SourceBoundVectorStyleLayerDefinition { public init(identifier: String, source: Source) { self.identifier = identifier self.source = .source(source) + self.sourceLayerIdentifier = nil } - public init(identifier: String, source: MLNSource) { + public init(identifier: String, source: MLNSource, sourceLayerIdentifier: String? = nil) { self.identifier = identifier self.source = .mglSource(source) + self.sourceLayerIdentifier = sourceLayerIdentifier } public func makeStyleLayer(style: MLNStyle) -> StyleLayer { @@ -69,6 +72,7 @@ private struct CircleStyleLayerInternal: StyleLayer { public func makeMLNStyleLayer() -> MLNStyleLayer { let result = MLNCircleStyleLayer(identifier: identifier, source: mglSource) + result.sourceLayerIdentifier = definition.sourceLayerIdentifier result.circleRadius = definition.radius result.circleColor = definition.color diff --git a/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift b/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift index 45338cf..c80fbab 100644 --- a/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift +++ b/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift @@ -5,13 +5,23 @@ import MapLibreSwiftMacros @MLNStyleProperty("iconRotation", supportsInterpolation: true) @MLNStyleProperty("iconColor", supportsInterpolation: true) +@MLNStyleProperty("iconAllowsOverlap", supportsInterpolation: false) + @MLNStyleProperty("textColor", supportsInterpolation: true) @MLNStyleProperty("textFontSize", supportsInterpolation: true) @MLNStyleProperty("text", supportsInterpolation: false) -@MLNStyleProperty("iconAllowsOverlap", supportsInterpolation: false) +// An enum would probably be better? +@MLNStyleProperty("textAnchor", supportsInterpolation: false) +@MLNStyleProperty("textOffset", supportsInterpolation: true) +@MLNStyleProperty("maximumTextWidth", supportsInterpolation: true) + +@MLNStyleProperty("textHaloColor", supportsInterpolation: true) +@MLNStyleProperty("textHaloWidth", supportsInterpolation: true) +@MLNStyleProperty("textHaloBlur", supportsInterpolation: true) public struct SymbolStyleLayer: SourceBoundVectorStyleLayerDefinition { public let identifier: String + public let sourceLayerIdentifier: String? public var insertionPosition: LayerInsertionPosition = .aboveOthers public var isVisible: Bool = true public var maximumZoomLevel: Float? = nil @@ -22,12 +32,15 @@ public struct SymbolStyleLayer: SourceBoundVectorStyleLayerDefinition { public init(identifier: String, source: Source) { self.identifier = identifier + self.sourceLayerIdentifier = nil self.source = .source(source) } - public init(identifier: String, source: MLNSource) { + public init(identifier: String, source: MLNSource, sourceLayerIdentifier: String? = nil) { self.identifier = identifier + self.sourceLayerIdentifier = sourceLayerIdentifier self.source = .mglSource(source) + } public func makeStyleLayer(style: MLNStyle) -> StyleLayer { @@ -40,10 +53,9 @@ public struct SymbolStyleLayer: SourceBoundVectorStyleLayerDefinition { return SymbolStyleLayerInternal(definition: self, mglSource: styleSource) } - // TODO: Other properties and their modifiers - fileprivate var iconImageName: NSExpression? + public var iconImageName: NSExpression? - private var iconImages = [UIImage]() + public var iconImages = [UIImage]() // MARK: - Modifiers @@ -53,6 +65,12 @@ public struct SymbolStyleLayer: SourceBoundVectorStyleLayerDefinition { it.iconImages = [image] } } + + public func iconImage(featurePropertyNamed keyPath: String) -> Self { + var copy = self + copy.iconImageName = NSExpression(forKeyPath: keyPath) + return copy + } // FIXME: This appears to be broken upstream; waiting for a new release // public func iconImage(attribute: String, mappings: [AnyHashable: UIImage], default defaultImage: UIImage) -> Self @@ -66,6 +84,29 @@ public struct SymbolStyleLayer: SourceBoundVectorStyleLayerDefinition { // it.iconImages = mappings.values + [defaultImage] // } // } + + /// Add an icon image that can be dynamic and use UIImages in your app, based on a feature property of the source. For example, your feature could have a property called "icon-name". This name is then resolved against the key in the mappings dictionary and used to find a UIImage to display on the map for that feature. + /// - Parameters: + /// - keyPath: The keypath to the feature property containing the icon to use, for example "icon-name". + /// - mappings: A lookup dictionary containing the keys found in "keyPath" and a UIImage for each keyPath. The key of the mappings dictionary needs to match the value type stored at keyPath, for example `String`. + /// - defaultImage: A UIImage that MapLibre should fall back to if the key in your feature is not found in the mappings table + public func iconImage(featurePropertyNamed keyPath: String, mappings: [AnyHashable: UIImage], default defaultImage: UIImage) -> Self { + return modified(self) { it in + let attributeExpression = NSExpression(forKeyPath: keyPath) + let mappingExpressions = mappings.mapValues { image in + NSExpression(forConstantValue: image.sha256()) + } + let mappingDictionary = NSDictionary(dictionary: mappingExpressions) + let defaultExpression = NSExpression(forConstantValue: defaultImage.sha256()) + + it.iconImageName = NSExpression( + forMLNMatchingKey: attributeExpression, + in: mappingDictionary as! [NSExpression: NSExpression], + default: defaultExpression + ) + it.iconImages = mappings.values + [defaultImage] + } + } } private struct SymbolStyleLayerInternal: StyleLayer { @@ -100,16 +141,24 @@ private struct SymbolStyleLayerInternal: StyleLayer { public func makeMLNStyleLayer() -> MLNStyleLayer { let result = MLNSymbolStyleLayer(identifier: identifier, source: mglSource) - + result.sourceLayerIdentifier = definition.sourceLayerIdentifier + result.iconImageName = definition.iconImageName result.iconRotation = definition.iconRotation + result.iconAllowsOverlap = definition.iconAllowsOverlap result.iconColor = definition.iconColor + result.text = definition.text result.textColor = definition.textColor result.textFontSize = definition.textFontSize - - result.iconAllowsOverlap = definition.iconAllowsOverlap - + result.maximumTextWidth = definition.maximumTextWidth + result.textAnchor = definition.textAnchor + result.textOffset = definition.textOffset + + result.textHaloColor = definition.textHaloColor + result.textHaloWidth = definition.textHaloWidth + result.textHaloBlur = definition.textHaloBlur + result.predicate = definition.predicate return result From 4a69c57bd2cf404d6a801191a3645f0a5578ba50 Mon Sep 17 00:00:00 2001 From: PW Date: Thu, 11 Jul 2024 12:36:15 +0200 Subject: [PATCH 2/6] adding zoom level support via modifier --- .../MapLibreSwiftDSL/Style Layers/Style Layer.swift | 10 ++++++++++ Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/Sources/MapLibreSwiftDSL/Style Layers/Style Layer.swift b/Sources/MapLibreSwiftDSL/Style Layers/Style Layer.swift index 814f754..e1320a8 100644 --- a/Sources/MapLibreSwiftDSL/Style Layers/Style Layer.swift +++ b/Sources/MapLibreSwiftDSL/Style Layers/Style Layer.swift @@ -161,3 +161,13 @@ public extension StyleLayer { modified(self) { $0.insertionPosition = .belowOthers } } } + +public extension StyleLayerDefinition { + func minimumZoomLevel(_ value: Float) -> Self { + modified(self) { $0.minimumZoomLevel = value } + } + + func maximumZoomLevel(_ value: Float) -> Self { + modified(self) { $0.maximumZoomLevel = value } + } +} diff --git a/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift b/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift index c80fbab..5d6c3b6 100644 --- a/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift +++ b/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift @@ -160,6 +160,14 @@ private struct SymbolStyleLayerInternal: StyleLayer { result.textHaloBlur = definition.textHaloBlur result.predicate = definition.predicate + + if let minimumZoomLevel = definition.minimumZoomLevel { + result.minimumZoomLevel = minimumZoomLevel + } + + if let maximumZoomLevel = definition.maximumZoomLevel { + result.maximumZoomLevel = maximumZoomLevel + } return result } From 05d6cf3e639bdf05f22f93df3a02c4e5c74005c2 Mon Sep 17 00:00:00 2001 From: Patrick Kladek Date: Tue, 16 Jul 2024 18:28:34 +0200 Subject: [PATCH 3/6] use newest Mockable version --- Package.resolved | 18 +++++++++--------- Package.swift | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Package.resolved b/Package.resolved index 8b80b5a..3776037 100644 --- a/Package.resolved +++ b/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/maplibre/maplibre-gl-native-distribution.git", "state" : { - "revision" : "6d0071977ed1f2380c739715f82ac650f99b0824", - "version" : "6.4.0" + "revision" : "039ef525064a685c291db5118f6b5f6e8b090bb0", + "version" : "6.5.2" } }, { @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/stadiamaps/maplibre-swift-macros.git", "state" : { - "revision" : "d52adbcbfaf96bd0723a156bd838826916ff7a69", - "version" : "0.0.3" + "revision" : "236215c13bff962009e0f0257d6d8349be33442f", + "version" : "0.0.4" } }, { @@ -23,8 +23,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Kolos65/Mockable.git", "state" : { - "revision" : "3b79620f2b916941035b5544bbca321fa7b33ed4", - "version" : "0.0.3" + "branch" : "main", + "revision" : "ccec0efd3e4a48b85b5407f788916de265c986dc" } }, { @@ -32,14 +32,14 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-snapshot-testing", "state" : { - "revision" : "625ccca8570773dd84a34ee51a81aa2bc5a4f97a", - "version" : "1.16.0" + "revision" : "c097f955b4e724690f0fc8ffb7a6d4b881c9c4e3", + "version" : "1.17.2" } }, { "identity" : "swift-syntax", "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-syntax", + "location" : "https://github.com/swiftlang/swift-syntax.git", "state" : { "revision" : "64889f0c732f210a935a0ad7cda38f77f876262d", "version" : "509.1.1" diff --git a/Package.swift b/Package.swift index 06a554e..23b5afd 100644 --- a/Package.swift +++ b/Package.swift @@ -24,7 +24,7 @@ let package = Package( .package(url: "https://github.com/maplibre/maplibre-gl-native-distribution.git", from: "6.4.0"), .package(url: "https://github.com/stadiamaps/maplibre-swift-macros.git", from: "0.0.3"), // Testing - .package(url: "https://github.com/Kolos65/Mockable.git", exact: "0.0.3"), + .package(url: "https://github.com/Kolos65/Mockable.git", branch: "main"), .package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.15.3"), ], targets: [ From 6a9d74aa21ec9120257b09b57ecda2c143e88aa2 Mon Sep 17 00:00:00 2001 From: PW Date: Tue, 23 Jul 2024 09:52:48 +0200 Subject: [PATCH 4/6] adding as centralized value --- Sources/MapLibreSwiftDSL/Style Layers/Line.swift | 6 +++++- Sources/MapLibreSwiftDSL/Style Layers/Style Layer.swift | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/MapLibreSwiftDSL/Style Layers/Line.swift b/Sources/MapLibreSwiftDSL/Style Layers/Line.swift index c6d65cb..68e362d 100644 --- a/Sources/MapLibreSwiftDSL/Style Layers/Line.swift +++ b/Sources/MapLibreSwiftDSL/Style Layers/Line.swift @@ -9,7 +9,9 @@ import MapLibreSwiftMacros @MLNRawRepresentableStyleProperty("lineJoin") @MLNStyleProperty("lineWidth", supportsInterpolation: true) public struct LineStyleLayer: SourceBoundVectorStyleLayerDefinition { + public let identifier: String + public let sourceLayerIdentifier: String? public var insertionPosition: LayerInsertionPosition = .aboveOthers public var isVisible: Bool = true public var maximumZoomLevel: Float? = nil @@ -21,11 +23,13 @@ public struct LineStyleLayer: SourceBoundVectorStyleLayerDefinition { public init(identifier: String, source: Source) { self.identifier = identifier self.source = .source(source) + self.sourceLayerIdentifier = nil } - public init(identifier: String, source: MLNSource) { + public init(identifier: String, source: MLNSource, sourceLayerIdentifier: String? = nil) { self.identifier = identifier self.source = .mglSource(source) + self.sourceLayerIdentifier = sourceLayerIdentifier } public func makeStyleLayer(style: MLNStyle) -> StyleLayer { diff --git a/Sources/MapLibreSwiftDSL/Style Layers/Style Layer.swift b/Sources/MapLibreSwiftDSL/Style Layers/Style Layer.swift index e1320a8..3bb30f4 100644 --- a/Sources/MapLibreSwiftDSL/Style Layers/Style Layer.swift +++ b/Sources/MapLibreSwiftDSL/Style Layers/Style Layer.swift @@ -75,6 +75,8 @@ public protocol StyleLayerDefinition { public protocol SourceBoundStyleLayerDefinition: StyleLayerDefinition { var source: StyleLayerSource { get set } + + var sourceLayerIdentifier: String? { get } } /// Based on MLNVectorStyleLayer From 5b3a19d746f776c86bee4afece38a97585278f65 Mon Sep 17 00:00:00 2001 From: PW Date: Thu, 25 Jul 2024 11:47:56 +0200 Subject: [PATCH 5/6] linting --- .../Style Layers/Circle.swift | 2 +- .../MapLibreSwiftDSL/Style Layers/Line.swift | 3 +- .../Style Layers/Style Layer.swift | 4 +- .../Style Layers/Symbol.swift | 39 +++++++++++-------- Sources/MapLibreSwiftUI/Examples/Layers.swift | 11 +++--- 5 files changed, 33 insertions(+), 26 deletions(-) diff --git a/Sources/MapLibreSwiftDSL/Style Layers/Circle.swift b/Sources/MapLibreSwiftDSL/Style Layers/Circle.swift index 1094953..040065e 100644 --- a/Sources/MapLibreSwiftDSL/Style Layers/Circle.swift +++ b/Sources/MapLibreSwiftDSL/Style Layers/Circle.swift @@ -21,7 +21,7 @@ public struct CircleStyleLayer: SourceBoundVectorStyleLayerDefinition { public init(identifier: String, source: Source) { self.identifier = identifier self.source = .source(source) - self.sourceLayerIdentifier = nil + sourceLayerIdentifier = nil } public init(identifier: String, source: MLNSource, sourceLayerIdentifier: String? = nil) { diff --git a/Sources/MapLibreSwiftDSL/Style Layers/Line.swift b/Sources/MapLibreSwiftDSL/Style Layers/Line.swift index 68e362d..1c10508 100644 --- a/Sources/MapLibreSwiftDSL/Style Layers/Line.swift +++ b/Sources/MapLibreSwiftDSL/Style Layers/Line.swift @@ -9,7 +9,6 @@ import MapLibreSwiftMacros @MLNRawRepresentableStyleProperty("lineJoin") @MLNStyleProperty("lineWidth", supportsInterpolation: true) public struct LineStyleLayer: SourceBoundVectorStyleLayerDefinition { - public let identifier: String public let sourceLayerIdentifier: String? public var insertionPosition: LayerInsertionPosition = .aboveOthers @@ -23,7 +22,7 @@ public struct LineStyleLayer: SourceBoundVectorStyleLayerDefinition { public init(identifier: String, source: Source) { self.identifier = identifier self.source = .source(source) - self.sourceLayerIdentifier = nil + sourceLayerIdentifier = nil } public init(identifier: String, source: MLNSource, sourceLayerIdentifier: String? = nil) { diff --git a/Sources/MapLibreSwiftDSL/Style Layers/Style Layer.swift b/Sources/MapLibreSwiftDSL/Style Layers/Style Layer.swift index 3bb30f4..435d562 100644 --- a/Sources/MapLibreSwiftDSL/Style Layers/Style Layer.swift +++ b/Sources/MapLibreSwiftDSL/Style Layers/Style Layer.swift @@ -75,7 +75,7 @@ public protocol StyleLayerDefinition { public protocol SourceBoundStyleLayerDefinition: StyleLayerDefinition { var source: StyleLayerSource { get set } - + var sourceLayerIdentifier: String? { get } } @@ -168,7 +168,7 @@ public extension StyleLayerDefinition { func minimumZoomLevel(_ value: Float) -> Self { modified(self) { $0.minimumZoomLevel = value } } - + func maximumZoomLevel(_ value: Float) -> Self { modified(self) { $0.maximumZoomLevel = value } } diff --git a/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift b/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift index 5d6c3b6..3f7ce1d 100644 --- a/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift +++ b/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift @@ -32,7 +32,7 @@ public struct SymbolStyleLayer: SourceBoundVectorStyleLayerDefinition { public init(identifier: String, source: Source) { self.identifier = identifier - self.sourceLayerIdentifier = nil + sourceLayerIdentifier = nil self.source = .source(source) } @@ -40,7 +40,6 @@ public struct SymbolStyleLayer: SourceBoundVectorStyleLayerDefinition { self.identifier = identifier self.sourceLayerIdentifier = sourceLayerIdentifier self.source = .mglSource(source) - } public func makeStyleLayer(style: MLNStyle) -> StyleLayer { @@ -65,7 +64,7 @@ public struct SymbolStyleLayer: SourceBoundVectorStyleLayerDefinition { it.iconImages = [image] } } - + public func iconImage(featurePropertyNamed keyPath: String) -> Self { var copy = self copy.iconImageName = NSExpression(forKeyPath: keyPath) @@ -84,21 +83,29 @@ public struct SymbolStyleLayer: SourceBoundVectorStyleLayerDefinition { // it.iconImages = mappings.values + [defaultImage] // } // } - - /// Add an icon image that can be dynamic and use UIImages in your app, based on a feature property of the source. For example, your feature could have a property called "icon-name". This name is then resolved against the key in the mappings dictionary and used to find a UIImage to display on the map for that feature. + + /// Add an icon image that can be dynamic and use UIImages in your app, based on a feature property of the source. + /// For example, your feature could have a property called "icon-name". This name is then resolved against the key + /// in the mappings dictionary and used to find a UIImage to display on the map for that feature. /// - Parameters: /// - keyPath: The keypath to the feature property containing the icon to use, for example "icon-name". - /// - mappings: A lookup dictionary containing the keys found in "keyPath" and a UIImage for each keyPath. The key of the mappings dictionary needs to match the value type stored at keyPath, for example `String`. - /// - defaultImage: A UIImage that MapLibre should fall back to if the key in your feature is not found in the mappings table - public func iconImage(featurePropertyNamed keyPath: String, mappings: [AnyHashable: UIImage], default defaultImage: UIImage) -> Self { - return modified(self) { it in + /// - mappings: A lookup dictionary containing the keys found in "keyPath" and a UIImage for each keyPath. The key + /// of the mappings dictionary needs to match the value type stored at keyPath, for example `String`. + /// - defaultImage: A UIImage that MapLibre should fall back to if the key in your feature is not found in the + /// mappings table + public func iconImage( + featurePropertyNamed keyPath: String, + mappings: [AnyHashable: UIImage], + default defaultImage: UIImage + ) -> Self { + modified(self) { it in let attributeExpression = NSExpression(forKeyPath: keyPath) let mappingExpressions = mappings.mapValues { image in NSExpression(forConstantValue: image.sha256()) } let mappingDictionary = NSDictionary(dictionary: mappingExpressions) let defaultExpression = NSExpression(forConstantValue: defaultImage.sha256()) - + it.iconImageName = NSExpression( forMLNMatchingKey: attributeExpression, in: mappingDictionary as! [NSExpression: NSExpression], @@ -142,29 +149,29 @@ private struct SymbolStyleLayerInternal: StyleLayer { public func makeMLNStyleLayer() -> MLNStyleLayer { let result = MLNSymbolStyleLayer(identifier: identifier, source: mglSource) result.sourceLayerIdentifier = definition.sourceLayerIdentifier - + result.iconImageName = definition.iconImageName result.iconRotation = definition.iconRotation result.iconAllowsOverlap = definition.iconAllowsOverlap result.iconColor = definition.iconColor - + result.text = definition.text result.textColor = definition.textColor result.textFontSize = definition.textFontSize result.maximumTextWidth = definition.maximumTextWidth result.textAnchor = definition.textAnchor result.textOffset = definition.textOffset - + result.textHaloColor = definition.textHaloColor result.textHaloWidth = definition.textHaloWidth result.textHaloBlur = definition.textHaloBlur - + result.predicate = definition.predicate - + if let minimumZoomLevel = definition.minimumZoomLevel { result.minimumZoomLevel = minimumZoomLevel } - + if let maximumZoomLevel = definition.maximumZoomLevel { result.maximumZoomLevel = maximumZoomLevel } diff --git a/Sources/MapLibreSwiftUI/Examples/Layers.swift b/Sources/MapLibreSwiftUI/Examples/Layers.swift index bbd40fd..dac3096 100644 --- a/Sources/MapLibreSwiftUI/Examples/Layers.swift +++ b/Sources/MapLibreSwiftUI/Examples/Layers.swift @@ -133,17 +133,18 @@ let clustered = ShapeSource(identifier: "points", options: [.clustered: true, .c .ignoresSafeArea(.all) } -// TODO: Fixme +// This example does not work within a package? But it does work when in a real app // #Preview("Multiple Symbol Icons") { // MapView(styleURL: demoTilesURL) { // // Simple symbol layer demonstration with an icon // SymbolStyleLayer(identifier: "simple-symbols", source: pointSource) -// .iconImage(attribute: "icon", +// .iconImage(featurePropertyNamed: "icon", // mappings: [ -// "missing": UIImage(systemName: "mappin.slash")!, -// "club": UIImage(systemName: "figure.dance")! +// "missing": UIImage(systemName: "mappin.slash")!, +// "club": UIImage(systemName: "figure.dance")!, // ], // default: UIImage(systemName: "mappin")!) +// .iconColor(.red) // } -// .edgesIgnoringSafeArea(.all) +// .ignoresSafeArea(.all) // } From 43b2fffb9036d9c90c0a82cbd32743c4779addc3 Mon Sep 17 00:00:00 2001 From: PW Date: Thu, 25 Jul 2024 11:51:51 +0200 Subject: [PATCH 6/6] removing commented out implementation --- Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift b/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift index 3f7ce1d..2db5f1b 100644 --- a/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift +++ b/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift @@ -71,19 +71,6 @@ public struct SymbolStyleLayer: SourceBoundVectorStyleLayerDefinition { return copy } - // FIXME: This appears to be broken upstream; waiting for a new release -// public func iconImage(attribute: String, mappings: [AnyHashable: UIImage], default defaultImage: UIImage) -> Self -// { -// return modified(self) { it in -// it.iconImageName = NSExpression(forMLNMatchingKey: NSExpression(forConstantValue: attribute), -// in: Dictionary(uniqueKeysWithValues: mappings.map({ (k, v) in -// (NSExpression(forConstantValue: k), NSExpression(forConstantValue: v.sha256())) -// })), -// default: NSExpression(forConstantValue: defaultImage.sha256())) -// it.iconImages = mappings.values + [defaultImage] -// } -// } - /// Add an icon image that can be dynamic and use UIImages in your app, based on a feature property of the source. /// For example, your feature could have a property called "icon-name". This name is then resolved against the key /// in the mappings dictionary and used to find a UIImage to display on the map for that feature.