From 98aa8cdda9d273158642b9d324f519b92f005447 Mon Sep 17 00:00:00 2001 From: Scott Hoyt Date: Wed, 13 Aug 2025 16:10:43 -0700 Subject: [PATCH 1/2] Cleanup with SwiftFormat --- Sources/MapLibreSwiftDSL/Style Layers/Background.swift | 4 ++-- Sources/MapLibreSwiftDSL/Style Layers/Circle.swift | 4 ++-- Sources/MapLibreSwiftDSL/Style Layers/FillStyleLayer.swift | 4 ++-- Sources/MapLibreSwiftDSL/Style Layers/Line.swift | 4 ++-- Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift | 4 ++-- Sources/MapLibreSwiftUI/Examples/Camera.swift | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Sources/MapLibreSwiftDSL/Style Layers/Background.swift b/Sources/MapLibreSwiftDSL/Style Layers/Background.swift index 0f9e104..e5d4ec5 100644 --- a/Sources/MapLibreSwiftDSL/Style Layers/Background.swift +++ b/Sources/MapLibreSwiftDSL/Style Layers/Background.swift @@ -9,8 +9,8 @@ public struct BackgroundLayer: StyleLayer { public let identifier: String public var insertionPosition: LayerInsertionPosition = .below(.all) public var isVisible: Bool = true - public var maximumZoomLevel: Float? = nil - public var minimumZoomLevel: Float? = nil + public var maximumZoomLevel: Float? + public var minimumZoomLevel: Float? public init(identifier: String) { self.identifier = identifier diff --git a/Sources/MapLibreSwiftDSL/Style Layers/Circle.swift b/Sources/MapLibreSwiftDSL/Style Layers/Circle.swift index 6026212..9e6794a 100644 --- a/Sources/MapLibreSwiftDSL/Style Layers/Circle.swift +++ b/Sources/MapLibreSwiftDSL/Style Layers/Circle.swift @@ -12,8 +12,8 @@ public struct CircleStyleLayer: SourceBoundVectorStyleLayerDefinition { public let sourceLayerIdentifier: String? public var insertionPosition: LayerInsertionPosition = .above(.all) public var isVisible: Bool = true - public var maximumZoomLevel: Float? = nil - public var minimumZoomLevel: Float? = nil + public var maximumZoomLevel: Float? + public var minimumZoomLevel: Float? public var source: StyleLayerSource public var predicate: NSPredicate? diff --git a/Sources/MapLibreSwiftDSL/Style Layers/FillStyleLayer.swift b/Sources/MapLibreSwiftDSL/Style Layers/FillStyleLayer.swift index f610c27..c6b9a47 100644 --- a/Sources/MapLibreSwiftDSL/Style Layers/FillStyleLayer.swift +++ b/Sources/MapLibreSwiftDSL/Style Layers/FillStyleLayer.swift @@ -12,8 +12,8 @@ public struct FillStyleLayer: SourceBoundVectorStyleLayerDefinition { public let sourceLayerIdentifier: String? public var insertionPosition: LayerInsertionPosition = .above(.all) public var isVisible: Bool = true - public var maximumZoomLevel: Float? = nil - public var minimumZoomLevel: Float? = nil + public var maximumZoomLevel: Float? + public var minimumZoomLevel: Float? public var source: StyleLayerSource public var predicate: NSPredicate? diff --git a/Sources/MapLibreSwiftDSL/Style Layers/Line.swift b/Sources/MapLibreSwiftDSL/Style Layers/Line.swift index 6e50dfd..5286c8d 100644 --- a/Sources/MapLibreSwiftDSL/Style Layers/Line.swift +++ b/Sources/MapLibreSwiftDSL/Style Layers/Line.swift @@ -14,8 +14,8 @@ public struct LineStyleLayer: SourceBoundVectorStyleLayerDefinition { public let sourceLayerIdentifier: String? public var insertionPosition: LayerInsertionPosition = .above(.all) public var isVisible: Bool = true - public var maximumZoomLevel: Float? = nil - public var minimumZoomLevel: Float? = nil + public var maximumZoomLevel: Float? + public var minimumZoomLevel: Float? public var source: StyleLayerSource public var predicate: NSPredicate? diff --git a/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift b/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift index 779753a..f898780 100644 --- a/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift +++ b/Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift @@ -29,8 +29,8 @@ public struct SymbolStyleLayer: SourceBoundVectorStyleLayerDefinition { public let sourceLayerIdentifier: String? public var insertionPosition: LayerInsertionPosition = .above(.all) public var isVisible: Bool = true - public var maximumZoomLevel: Float? = nil - public var minimumZoomLevel: Float? = nil + public var maximumZoomLevel: Float? + public var minimumZoomLevel: Float? public var source: StyleLayerSource public var predicate: NSPredicate? diff --git a/Sources/MapLibreSwiftUI/Examples/Camera.swift b/Sources/MapLibreSwiftUI/Examples/Camera.swift index a7f0f11..10bb005 100644 --- a/Sources/MapLibreSwiftUI/Examples/Camera.swift +++ b/Sources/MapLibreSwiftUI/Examples/Camera.swift @@ -5,8 +5,8 @@ struct CameraDirectManipulationPreview: View { @State private var camera = MapViewCamera.center(switzerland, zoom: 4) let styleURL: URL - var onStyleLoaded: (() -> Void)? = nil - var targetCameraAfterDelay: MapViewCamera? = nil + var onStyleLoaded: (() -> Void)? + var targetCameraAfterDelay: MapViewCamera? var body: some View { MapView(styleURL: styleURL, camera: $camera) From 8cdec1be46449616030bd0b0ccc03001f8c99383 Mon Sep 17 00:00:00 2001 From: Scott Hoyt Date: Tue, 12 Aug 2025 16:10:50 -0700 Subject: [PATCH 2/2] Add lastHeading property to StaticLocationManager. --- Sources/MapLibreSwiftUI/StaticLocationManager.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Sources/MapLibreSwiftUI/StaticLocationManager.swift b/Sources/MapLibreSwiftUI/StaticLocationManager.swift index b94ba51..020c64d 100644 --- a/Sources/MapLibreSwiftUI/StaticLocationManager.swift +++ b/Sources/MapLibreSwiftUI/StaticLocationManager.swift @@ -8,7 +8,7 @@ import MapLibre /// doing some processing of raw location data (ex: determining whether to snap locations to a road) and selectively /// passing the updates on to the map view. /// -/// You can provide a new location by setting the ``lastLocation`` property. +/// You can provide updates by setting the ``lastLocation`` or ``lastHeading`` properties. /// /// While this class is required to implement authorization status per the underlying protocol, /// it does not ever actually check whether you have access to Core Location services. @@ -30,6 +30,13 @@ public final class StaticLocationManager: NSObject, @unchecked Sendable { } } + public var lastHeading: CLHeading? { + didSet { + guard let heading = lastHeading else { return } + delegate?.locationManager(self, didUpdate: heading) + } + } + public init(initialLocation: CLLocation) { lastLocation = initialLocation }