Skip to content

Commit 486013d

Browse files
committed
linting
1 parent 4d69cd5 commit 486013d

File tree

6 files changed

+30
-34
lines changed

6 files changed

+30
-34
lines changed

Sources/MapLibreSwiftDSL/ShapeDataBuilder.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,17 @@ public enum ShapeData {
2121

2222
public struct ShapeSource: Source {
2323
public let identifier: String
24-
public let options: [MLNShapeSourceOption : Any]?
24+
public let options: [MLNShapeSourceOption: Any]?
2525
let data: ShapeData
2626

27-
public init(identifier: String, options: [MLNShapeSourceOption : Any]? = nil, @ShapeDataBuilder _ makeShapeDate: () -> ShapeData) {
27+
public init(
28+
identifier: String,
29+
options: [MLNShapeSourceOption: Any]? = nil,
30+
@ShapeDataBuilder _ makeShapeDate: () -> ShapeData
31+
) {
2832
self.identifier = identifier
2933
self.options = options
3034
data = makeShapeDate()
31-
3235
}
3336

3437
public func makeMGLSource() -> MLNSource {

Sources/MapLibreSwiftDSL/Style Layers/Circle.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import MapLibreSwiftMacros
88
@MLNStyleProperty<Double>("strokeWidth", supportsInterpolation: true)
99
@MLNStyleProperty<UIColor>("strokeColor", supportsInterpolation: false)
1010
public struct CircleStyleLayer: SourceBoundVectorStyleLayerDefinition {
11-
1211
public let identifier: String
1312
public var insertionPosition: LayerInsertionPosition = .aboveOthers
1413
public var isVisible: Bool = true
@@ -35,8 +34,6 @@ public struct CircleStyleLayer: SourceBoundVectorStyleLayerDefinition {
3534
}
3635

3736
// MARK: - Modifiers
38-
39-
4037
}
4138

4239
private struct CircleStyleLayerInternal: StyleLayer {
@@ -80,7 +77,6 @@ private struct CircleStyleLayerInternal: StyleLayer {
8077

8178
result.predicate = definition.predicate
8279

83-
8480
return result
8581
}
8682
}

Sources/MapLibreSwiftDSL/Style Layers/Line.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ private struct LineStyleLayerInternal: StyleLayer {
7272
result.lineCap = definition.lineCap
7373
result.lineWidth = definition.lineWidth
7474
result.lineJoin = definition.lineJoin
75-
75+
7676
result.predicate = definition.predicate
77-
7877

7978
return result
8079
}

Sources/MapLibreSwiftDSL/Style Layers/Style Layer.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,32 +77,30 @@ public protocol SourceBoundStyleLayerDefinition: StyleLayerDefinition {
7777
var source: StyleLayerSource { get set }
7878
}
7979

80-
8180
/// Based on MLNVectorStyleLayer
8281
public protocol SourceBoundVectorStyleLayerDefinition: SourceBoundStyleLayerDefinition {
8382
/**
8483
The style layer’s predicate.
85-
84+
8685
Use the style layer’s predicate to include only the features in the source
8786
layer that satisfy a condition that you define.
88-
87+
8988
See the *Predicates and Expressions*
9089
guide for details about the predicate syntax supported by this class.
9190
*/
9291
var predicate: NSPredicate? { get set }
93-
92+
9493
func predicate(_ predicate: NSPredicate) -> Self
9594
}
9695

97-
extension SourceBoundVectorStyleLayerDefinition {
98-
public func predicate(_ predicate: NSPredicate) -> Self {
96+
public extension SourceBoundVectorStyleLayerDefinition {
97+
func predicate(_ predicate: NSPredicate) -> Self {
9998
modified(self) { it in
10099
it.predicate = predicate
101100
}
102101
}
103102
}
104103

105-
106104
extension SourceBoundStyleLayerDefinition {
107105
func addSource(to style: MLNStyle) -> MLNSource {
108106
let tmpSource: MLNSource

Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,10 @@ private struct SymbolStyleLayerInternal: StyleLayer {
107107
result.text = definition.text
108108
result.textColor = definition.textColor
109109
result.textFontSize = definition.textFontSize
110-
110+
111111
result.iconAllowsOverlap = definition.iconAllowsOverlap
112-
113-
result.predicate = definition.predicate
114112

115-
113+
result.predicate = definition.predicate
116114

117115
return result
118116
}

Sources/MapLibreSwiftUI/Examples/Layers.swift

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ let pointSource = ShapeSource(identifier: "points") {
2525
let clustered = ShapeSource(identifier: "points", options: [.clustered: true, .clusterRadius: 44]) {
2626
// Uses the DSL to quickly construct point features inline
2727
MLNPointFeature(coordinate: CLLocationCoordinate2D(latitude: 48.2082, longitude: 16.3719))
28-
28+
2929
MLNPointFeature(coordinate: CLLocationCoordinate2D(latitude: 48.3082, longitude: 16.3719))
30-
30+
3131
MLNPointFeature(coordinate: CLLocationCoordinate2D(latitude: 48.2082, longitude: 16.9719))
32-
32+
3333
MLNPointFeature(coordinate: CLLocationCoordinate2D(latitude: 48.0082, longitude: 17.9719))
3434
}
3535

@@ -89,37 +89,39 @@ let clustered = ShapeSource(identifier: "points", options: [.clustered: true, .c
8989
}
9090

9191
#Preview("Clustered Circles with Symbols") {
92-
@State var camera = MapViewCamera.center(CLLocationCoordinate2D(latitude: 48.2082, longitude: 16.3719), zoom: 5, direction: 0)
92+
@State var camera = MapViewCamera.center(
93+
CLLocationCoordinate2D(latitude: 48.2082, longitude: 16.3719),
94+
zoom: 5,
95+
direction: 0
96+
)
9397
return MapView(styleURL: demoTilesURL, camera: $camera) {
9498
// Clusters pins when they would touch
95-
99+
96100
// Cluster == YES shows only those pins that are clustered, using .text
97101
CircleStyleLayer(identifier: "simple-circles-clusters", source: clustered)
98102
.radius(16)
99103
.color(.systemRed)
100104
.strokeWidth(2)
101105
.strokeColor(.white)
102106
.predicate(NSPredicate(format: "cluster == YES"))
103-
107+
104108
SymbolStyleLayer(identifier: "simple-symbols-clusters", source: clustered)
105109
.textColor(.white)
106110
.text(expression: NSExpression(format: "CAST(point_count, 'NSString')"))
107111
.predicate(NSPredicate(format: "cluster == YES"))
108-
109-
112+
110113
// Cluster != YES shows only those pins that are not clustered, using an icon
111114
CircleStyleLayer(identifier: "simple-circles-non-clusters", source: clustered)
112115
.radius(16)
113116
.color(.systemRed)
114117
.strokeWidth(2)
115118
.strokeColor(.white)
116119
.predicate(NSPredicate(format: "cluster != YES"))
117-
118-
SymbolStyleLayer(identifier: "simple-symbols-non-clusters", source: clustered)
119-
.iconImage(UIImage(systemName: "mappin")!.withRenderingMode(.alwaysTemplate))
120-
.iconColor(.white)
121-
.predicate(NSPredicate(format: "cluster != YES"))
122-
120+
121+
SymbolStyleLayer(identifier: "simple-symbols-non-clusters", source: clustered)
122+
.iconImage(UIImage(systemName: "mappin")!.withRenderingMode(.alwaysTemplate))
123+
.iconColor(.white)
124+
.predicate(NSPredicate(format: "cluster != YES"))
123125
}
124126
.ignoresSafeArea(.all)
125127
}

0 commit comments

Comments
 (0)