Skip to content

Commit

Permalink
Expose typed Slot method
Browse files Browse the repository at this point in the history
  • Loading branch information
persidskiy committed Jan 17, 2025
1 parent 07a87d8 commit 0e6ebac
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 13 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ Mapbox welcomes participation and contributions from everyone.
* Localize geofencing attribution dialog.
* Support dictionary expression literals.
* Bump minimal deployment target from 12.0 to 14.0.
* [SwiftUI] Expose new `slot()` method on annotation groups that takes `Slot` instead of `String`. Use the type with annotationGroups:

swift
```
CircleAnnotationGroup {}
// old
.slot("middle")
// new
.slot(.middle)
```

## 11.9.0 - 18 December, 2024

Expand Down
1 change: 1 addition & 0 deletions Sources/Examples/SwiftUI Examples/AnnotationsExample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ struct AnnotationsExample: View {
viewport = .camera(center: context.coordinate, zoom: context.expansionZoom)
}
}
.slot(.middle)
}
.onMapTapGesture { context in
taps.append(Tap(coordinate: context.coordinate))
Expand Down
4 changes: 2 additions & 2 deletions Sources/Examples/SwiftUI Examples/DynamicStylingExample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ struct RouteLine: MapStyleContent {
.lineColor("#57A9FB")
.lineBorderColor("#327AC2")
.lineEmissiveStrength(1)
.slot("middle")
.slot(.middle)

LineLayer(id: "\(sourceId)-layer-casing", source: sourceId)
.lineCap(.round)
Expand All @@ -230,7 +230,7 @@ struct RouteLine: MapStyleContent {
.lineColor("#57A9FB")
.lineBorderColor("#327AC2")
.lineEmissiveStrength(1)
.slot("middle")
.slot(.middle)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct InteractionsPlayground: View {
}
}
.layerId("polygon")
.slot("bottom")
.slot(.bottom)

PolylineAnnotationGroup(routes) { route in
PolylineAnnotation(lineString: route.line)
Expand All @@ -52,7 +52,7 @@ struct InteractionsPlayground: View {
.lineWidth(10)
.lineBorderWidth(2)
.lineCap(.round)
.slot("middle")
.slot(.middle)

TapInteraction(.standardPoi, radius: 0) { feature, ctx in
text = "Tap poi \(feature.name ?? "-"), r: 0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct ViewAnnotationsExample: View {
}
.layerId(routeLayer) // Specify id for underlying line layer.
.lineCap(.round)
.slot("middle") // Display above roads and below 3D buildings and labels (for Standard Style).
.slot(.middle) // Display above roads and below 3D buildings and labels (for Standard Style).

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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0e6ebac

Please sign in to comment.