Skip to content

Commit 0e6ebac

Browse files
committed
Expose typed Slot method
1 parent 07a87d8 commit 0e6ebac

File tree

9 files changed

+60
-13
lines changed

9 files changed

+60
-13
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ Mapbox welcomes participation and contributions from everyone.
1212
* Localize geofencing attribution dialog.
1313
* Support dictionary expression literals.
1414
* Bump minimal deployment target from 12.0 to 14.0.
15+
* [SwiftUI] Expose new `slot()` method on annotation groups that takes `Slot` instead of `String`. Use the type with annotationGroups:
16+
17+
swift
18+
```
19+
CircleAnnotationGroup {}
20+
// old
21+
.slot("middle")
22+
// new
23+
.slot(.middle)
24+
```
1525

1626
## 11.9.0 - 18 December, 2024
1727

Sources/Examples/SwiftUI Examples/AnnotationsExample.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ struct AnnotationsExample: View {
100100
viewport = .camera(center: context.coordinate, zoom: context.expansionZoom)
101101
}
102102
}
103+
.slot(.middle)
103104
}
104105
.onMapTapGesture { context in
105106
taps.append(Tap(coordinate: context.coordinate))

Sources/Examples/SwiftUI Examples/DynamicStylingExample.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ struct RouteLine: MapStyleContent {
220220
.lineColor("#57A9FB")
221221
.lineBorderColor("#327AC2")
222222
.lineEmissiveStrength(1)
223-
.slot("middle")
223+
.slot(.middle)
224224

225225
LineLayer(id: "\(sourceId)-layer-casing", source: sourceId)
226226
.lineCap(.round)
@@ -230,7 +230,7 @@ struct RouteLine: MapStyleContent {
230230
.lineColor("#57A9FB")
231231
.lineBorderColor("#327AC2")
232232
.lineEmissiveStrength(1)
233-
.slot("middle")
233+
.slot(.middle)
234234
}
235235
}
236236

Sources/Examples/SwiftUI Examples/Testing Examples/InteractionsPlayground.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct InteractionsPlayground: View {
2828
}
2929
}
3030
.layerId("polygon")
31-
.slot("bottom")
31+
.slot(.bottom)
3232

3333
PolylineAnnotationGroup(routes) { route in
3434
PolylineAnnotation(lineString: route.line)
@@ -52,7 +52,7 @@ struct InteractionsPlayground: View {
5252
.lineWidth(10)
5353
.lineBorderWidth(2)
5454
.lineCap(.round)
55-
.slot("middle")
55+
.slot(.middle)
5656

5757
TapInteraction(.standardPoi, radius: 0) { feature, ctx in
5858
text = "Tap poi \(feature.name ?? "-"), r: 0"

Sources/Examples/SwiftUI Examples/ViewAnnotationsExample.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ struct ViewAnnotationsExample: View {
6464
}
6565
.layerId(routeLayer) // Specify id for underlying line layer.
6666
.lineCap(.round)
67-
.slot("middle") // Display above roads and below 3D buildings and labels (for Standard Style).
67+
.slot(.middle) // Display above roads and below 3D buildings and labels (for Standard Style).
6868

6969
MapViewAnnotation(layerId: routeLayer, featureId: routeFeature) {
7070
Text("1h 30m")

Sources/MapboxMaps/SwiftUI/Annotations/Generated/CircleAnnotationGroup.swift

Lines changed: 11 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/MapboxMaps/SwiftUI/Annotations/Generated/PointAnnotationGroup.swift

Lines changed: 11 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/MapboxMaps/SwiftUI/Annotations/Generated/PolygonAnnotationGroup.swift

Lines changed: 11 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/MapboxMaps/SwiftUI/Annotations/Generated/PolylineAnnotationGroup.swift

Lines changed: 11 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)