Skip to content

Commit

Permalink
Remove constant: argument label (part of #16)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthetechie committed Mar 10, 2024
1 parent e713f13 commit 6b59504
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 44 deletions.
22 changes: 11 additions & 11 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,44 @@
"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"
}
},
{
"identity" : "maplibre-swift-macros",
"kind" : "remoteSourceControl",
"location" : "https://github.com/stadiamaps/maplibre-swift-macros.git",
"state" : {
"revision" : "507939d324a6296554894e1a534bb3f9c91a82d8",
"version" : "0.0.1"
"revision" : "9f15cbb11d2b5248ead47aecae5be8a1d4d5f463",
"version" : "0.0.2"
}
},
{
"identity" : "mockable",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Kolos65/Mockable.git",
"state" : {
"revision" : "7af00c08880d375f2742ca55705abd69837fe6c3",
"version" : "0.0.2"
"revision" : "3b79620f2b916941035b5544bbca321fa7b33ed4",
"version" : "0.0.3"
}
},
{
"identity" : "swift-snapshot-testing",
"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"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
2 changes: 1 addition & 1 deletion Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
22 changes: 11 additions & 11 deletions Sources/MapLibreSwiftUI/Examples/Layers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand 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)
}
Expand 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)
}
Expand 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)
Expand 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)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/MapLibreSwiftUI/Examples/Other.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions Sources/MapLibreSwiftUI/Examples/Polyline.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ 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),
stops: NSExpression(forConstantValue: [14: 6, 18: 24]))

// 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),
Expand Down
4 changes: 2 additions & 2 deletions Tests/MapLibreSwiftDSLTests/StyleLayerTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
22 changes: 11 additions & 11 deletions Tests/MapLibreSwiftUITests/Examples/LayerPreviewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand All @@ -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")!)
}
}
}
Expand All @@ -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)
}
}
}
Expand All @@ -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")
}
}
Expand All @@ -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)
}
}
}
Expand Down

0 comments on commit 6b59504

Please sign in to comment.