Skip to content

Introduce line-dash-pattern on LineStyleLayer #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Sources/MapLibreSwiftDSL/Style Layers/Line.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import MapLibreSwiftMacros
@MLNStyleProperty<UIColor>("lineColor", supportsInterpolation: true)
@MLNRawRepresentableStyleProperty<LineCap>("lineCap")
@MLNRawRepresentableStyleProperty<LineJoin>("lineJoin")
@MLNStyleProperty<[Float]>("lineDashPattern")
@MLNStyleProperty<Float>("lineWidth", supportsInterpolation: true)
public struct LineStyleLayer: SourceBoundVectorStyleLayerDefinition {
public let identifier: String
Expand Down Expand Up @@ -75,7 +76,7 @@ private struct LineStyleLayerInternal: StyleLayer {
result.lineCap = definition.lineCap
result.lineWidth = definition.lineWidth
result.lineJoin = definition.lineJoin

result.lineDashPattern = definition.lineDashPattern
result.predicate = definition.predicate

return result
Expand Down
3 changes: 2 additions & 1 deletion Sources/MapLibreSwiftUI/Examples/Polyline.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ struct PolylineMapView: View {

// Add an inner (blue) polyline
LineStyleLayer(identifier: "polyline-inner", source: polylineSource)
.lineCap(.round)
.lineDashPattern([2.0, 0.5])
.lineCap(.butt)
.lineJoin(.round)
.lineColor(.systemBlue)
.lineWidth(interpolatedBy: .zoomLevel,
Expand Down
Loading