From 6b5950426cfdebd53821b8ea36cf08bb628a0466 Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Sun, 10 Mar 2024 22:52:28 +0900 Subject: [PATCH] Remove constant: argument label (part of #16) --- Package.resolved | 22 +++++++++---------- Package.swift | 2 +- .../Style Layers/Symbol.swift | 2 +- Sources/MapLibreSwiftUI/Examples/Layers.swift | 22 +++++++++---------- Sources/MapLibreSwiftUI/Examples/Other.swift | 2 +- .../MapLibreSwiftUI/Examples/Polyline.swift | 12 +++++----- .../StyleLayerTest.swift | 4 ++-- .../Examples/LayerPreviewTests.swift | 22 +++++++++---------- 8 files changed, 44 insertions(+), 44 deletions(-) diff --git a/Package.resolved b/Package.resolved index a0626bb..816bfbd 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" : "818e1d6b83e4cbe8482eca3e6e57d3f560926157", - "version" : "6.1.1" + "revision" : "92505cfbad5c5ed6a93e0f3cd70872aaa98a12ac", + "version" : "6.2.0" } }, { @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/stadiamaps/maplibre-swift-macros.git", "state" : { - "revision" : "507939d324a6296554894e1a534bb3f9c91a82d8", - "version" : "0.0.1" + "revision" : "9f15cbb11d2b5248ead47aecae5be8a1d4d5f463", + "version" : "0.0.2" } }, { @@ -23,8 +23,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Kolos65/Mockable.git", "state" : { - "revision" : "7af00c08880d375f2742ca55705abd69837fe6c3", - "version" : "0.0.2" + "revision" : "3b79620f2b916941035b5544bbca321fa7b33ed4", + "version" : "0.0.3" } }, { @@ -32,17 +32,17 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-snapshot-testing", "state" : { - "revision" : "e7b77228b34057041374ebef00c0fd7739d71a2b", - "version" : "1.15.3" + "revision" : "5b0c434778f2c1a4c9b5ebdb8682b28e84dd69bd", + "version" : "1.15.4" } }, { "identity" : "swift-syntax", "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-syntax.git", + "location" : "https://github.com/apple/swift-syntax", "state" : { - "revision" : "6ad4ea24b01559dde0773e3d091f1b9e36175036", - "version" : "509.0.2" + "revision" : "64889f0c732f210a935a0ad7cda38f77f876262d", + "version" : "509.1.1" } } ], diff --git a/Package.swift b/Package.swift index 432cf36..99c1f1b 100644 --- a/Package.swift +++ b/Package.swift @@ -22,7 +22,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/maplibre/maplibre-gl-native-distribution.git", from: "6.1.0"), - .package(url: "https://github.com/stadiamaps/maplibre-swift-macros.git", from: "0.0.1"), + .package(url: "https://github.com/stadiamaps/maplibre-swift-macros.git", from: "0.0.2"), // Testing .package(url: "https://github.com/Kolos65/Mockable.git", from: "0.0.2"), .package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.15.3"), diff --git a/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift b/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift index 4b240c2..3319251 100644 --- a/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift +++ b/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift @@ -42,7 +42,7 @@ public struct SymbolStyleLayer: SourceBoundStyleLayerDefinition { // MARK: - Modifiers - public func iconImage(constant image: UIImage) -> Self { + public func iconImage(_ image: UIImage) -> Self { modified(self) { it in it.iconImageName = NSExpression(forConstantValue: image.sha256()) it.iconImages = [image] diff --git a/Sources/MapLibreSwiftUI/Examples/Layers.swift b/Sources/MapLibreSwiftUI/Examples/Layers.swift index 098281a..3278ada 100644 --- a/Sources/MapLibreSwiftUI/Examples/Layers.swift +++ b/Sources/MapLibreSwiftUI/Examples/Layers.swift @@ -26,7 +26,7 @@ let pointSource = ShapeSource(identifier: "points") { MapView(styleURL: demoTilesURL) { // Silly example: a background layer on top of everything to create a tint effect BackgroundLayer(identifier: "rose-colored-glasses") - .backgroundColor(constant: .systemPink.withAlphaComponent(0.3)) + .backgroundColor(.systemPink.withAlphaComponent(0.3)) .renderAboveOthers() } .ignoresSafeArea(.all) @@ -36,7 +36,7 @@ let pointSource = ShapeSource(identifier: "points") { MapView(styleURL: demoTilesURL) { // Simple symbol layer demonstration with an icon SymbolStyleLayer(identifier: "simple-symbols", source: pointSource) - .iconImage(constant: UIImage(systemName: "mappin")!) + .iconImage(UIImage(systemName: "mappin")!) } .ignoresSafeArea(.all) } @@ -45,8 +45,8 @@ let pointSource = ShapeSource(identifier: "points") { MapView(styleURL: demoTilesURL) { // Simple symbol layer demonstration with an icon SymbolStyleLayer(identifier: "rotated-symbols", source: pointSource) - .iconImage(constant: UIImage(systemName: "location.north.circle.fill")!) - .iconRotation(constant: 45) + .iconImage(UIImage(systemName: "location.north.circle.fill")!) + .iconRotation(45) } .ignoresSafeArea(.all) } @@ -55,7 +55,7 @@ let pointSource = ShapeSource(identifier: "points") { MapView(styleURL: demoTilesURL) { // Simple symbol layer demonstration with an icon SymbolStyleLayer(identifier: "rotated-symbols", source: pointSource) - .iconImage(constant: UIImage(systemName: "location.north.circle.fill")!) + .iconImage(UIImage(systemName: "location.north.circle.fill")!) .iconRotation(featurePropertyNamed: "heading") } .ignoresSafeArea(.all) @@ -65,14 +65,14 @@ let pointSource = ShapeSource(identifier: "points") { MapView(styleURL: demoTilesURL) { // Simple symbol layer demonstration with an icon CircleStyleLayer(identifier: "simple-circles", source: pointSource) - .radius(constant: 16) - .color(constant: .systemRed) - .strokeWidth(constant: 2) - .strokeColor(constant: .white) + .radius(16) + .color(.systemRed) + .strokeWidth(2) + .strokeColor(.white) SymbolStyleLayer(identifier: "simple-symbols", source: pointSource) - .iconImage(constant: UIImage(systemName: "mappin")!.withRenderingMode(.alwaysTemplate)) - .iconColor(constant: .white) + .iconImage(UIImage(systemName: "mappin")!.withRenderingMode(.alwaysTemplate)) + .iconColor(.white) } .ignoresSafeArea(.all) } diff --git a/Sources/MapLibreSwiftUI/Examples/Other.swift b/Sources/MapLibreSwiftUI/Examples/Other.swift index 0d155ad..7e5b6a8 100644 --- a/Sources/MapLibreSwiftUI/Examples/Other.swift +++ b/Sources/MapLibreSwiftUI/Examples/Other.swift @@ -25,7 +25,7 @@ import SwiftUI // Demonstrates how to use the unsafeMapModifier to set MLNMapView properties that have not been exposed as // modifiers yet. SymbolStyleLayer(identifier: "simple-symbols", source: pointSource) - .iconImage(constant: UIImage(systemName: "mappin")!) + .iconImage(UIImage(systemName: "mappin")!) } .unsafeMapViewModifier { mapView in // Not all properties have modifiers yet. Until they do, you can use this 'escape hatch' to the underlying diff --git a/Sources/MapLibreSwiftUI/Examples/Polyline.swift b/Sources/MapLibreSwiftUI/Examples/Polyline.swift index 001e146..1e636a4 100644 --- a/Sources/MapLibreSwiftUI/Examples/Polyline.swift +++ b/Sources/MapLibreSwiftUI/Examples/Polyline.swift @@ -19,9 +19,9 @@ struct PolylinePreview: View { // Add a polyline casing for a stroke effect LineStyleLayer(identifier: "route-line-casing", source: polylineSource) - .lineCap(constant: .round) - .lineJoin(constant: .round) - .lineColor(constant: .white) + .lineCap(.round) + .lineJoin(.round) + .lineColor(.white) .lineWidth(interpolatedBy: .zoomLevel, curveType: .exponential, parameters: NSExpression(forConstantValue: 1.5), @@ -29,9 +29,9 @@ struct PolylinePreview: View { // Add an inner (blue) polyline LineStyleLayer(identifier: "route-line-inner", source: polylineSource) - .lineCap(constant: .round) - .lineJoin(constant: .round) - .lineColor(constant: .systemBlue) + .lineCap(.round) + .lineJoin(.round) + .lineColor(.systemBlue) .lineWidth(interpolatedBy: .zoomLevel, curveType: .exponential, parameters: NSExpression(forConstantValue: 1.5), diff --git a/Tests/MapLibreSwiftDSLTests/StyleLayerTest.swift b/Tests/MapLibreSwiftDSLTests/StyleLayerTest.swift index db0b40b..41d740c 100644 --- a/Tests/MapLibreSwiftDSLTests/StyleLayerTest.swift +++ b/Tests/MapLibreSwiftDSLTests/StyleLayerTest.swift @@ -5,8 +5,8 @@ import XCTest final class StyleLayerTest: XCTestCase { func testBackgroundStyleLayer() throws { let styleLayer = BackgroundLayer(identifier: "background") - .backgroundColor(constant: .cyan) - .backgroundOpacity(constant: 0.4) + .backgroundColor(.cyan) + .backgroundOpacity(0.4) let mglStyleLayer = styleLayer.makeMLNStyleLayer() as! MLNBackgroundStyleLayer diff --git a/Tests/MapLibreSwiftUITests/Examples/LayerPreviewTests.swift b/Tests/MapLibreSwiftUITests/Examples/LayerPreviewTests.swift index d3eb36f..862c7de 100644 --- a/Tests/MapLibreSwiftUITests/Examples/LayerPreviewTests.swift +++ b/Tests/MapLibreSwiftUITests/Examples/LayerPreviewTests.swift @@ -28,7 +28,7 @@ final class LayerPreviewTests: XCTestCase { MapView(styleURL: demoTilesURL) { // Silly example: a background layer on top of everything to create a tint effect BackgroundLayer(identifier: "rose-colored-glasses") - .backgroundColor(constant: .systemPink.withAlphaComponent(0.3)) + .backgroundColor(.systemPink.withAlphaComponent(0.3)) .renderAboveOthers() } } @@ -39,7 +39,7 @@ final class LayerPreviewTests: XCTestCase { MapView(styleURL: demoTilesURL) { // Simple symbol layer demonstration with an icon SymbolStyleLayer(identifier: "simple-symbols", source: pointSource) - .iconImage(constant: UIImage(systemName: "mappin")!) + .iconImage(UIImage(systemName: "mappin")!) } } } @@ -49,8 +49,8 @@ final class LayerPreviewTests: XCTestCase { MapView(styleURL: demoTilesURL) { // Simple symbol layer demonstration with an icon SymbolStyleLayer(identifier: "rotated-symbols", source: pointSource) - .iconImage(constant: UIImage(systemName: "location.north.circle.fill")!) - .iconRotation(constant: 45) + .iconImage(UIImage(systemName: "location.north.circle.fill")!) + .iconRotation(45) } } } @@ -60,7 +60,7 @@ final class LayerPreviewTests: XCTestCase { MapView(styleURL: demoTilesURL) { // Simple symbol layer demonstration with an icon SymbolStyleLayer(identifier: "rotated-symbols", source: pointSource) - .iconImage(constant: UIImage(systemName: "location.north.circle.fill")!) + .iconImage(UIImage(systemName: "location.north.circle.fill")!) .iconRotation(featurePropertyNamed: "heading") } } @@ -71,14 +71,14 @@ final class LayerPreviewTests: XCTestCase { MapView(styleURL: demoTilesURL) { // Simple symbol layer demonstration with an icon CircleStyleLayer(identifier: "simple-circles", source: pointSource) - .radius(constant: 16) - .color(constant: .systemRed) - .strokeWidth(constant: 2) - .strokeColor(constant: .white) + .radius(16) + .color(.systemRed) + .strokeWidth(2) + .strokeColor(.white) SymbolStyleLayer(identifier: "simple-symbols", source: pointSource) - .iconImage(constant: UIImage(systemName: "mappin")!.withRenderingMode(.alwaysTemplate)) - .iconColor(constant: .white) + .iconImage(UIImage(systemName: "mappin")!.withRenderingMode(.alwaysTemplate)) + .iconColor(.white) } } }