Skip to content

Add lastHeading property to StaticLocationManager. #99

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions Sources/MapLibreSwiftDSL/Style Layers/Background.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Sources/MapLibreSwiftDSL/Style Layers/Circle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
4 changes: 2 additions & 2 deletions Sources/MapLibreSwiftDSL/Style Layers/FillStyleLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
4 changes: 2 additions & 2 deletions Sources/MapLibreSwiftDSL/Style Layers/Line.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
4 changes: 2 additions & 2 deletions Sources/MapLibreSwiftDSL/Style Layers/Symbol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
4 changes: 2 additions & 2 deletions Sources/MapLibreSwiftUI/Examples/Camera.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 8 additions & 1 deletion Sources/MapLibreSwiftUI/StaticLocationManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
}
Expand Down
Loading