diff --git a/Sources/MapLibreSwiftUI/Extensions/MapLibre/MLNMapViewCameraUpdating.swift b/Sources/MapLibreSwiftUI/Extensions/MapLibre/MLNMapViewCameraUpdating.swift index aade5fd..7568bc2 100644 --- a/Sources/MapLibreSwiftUI/Extensions/MapLibre/MLNMapViewCameraUpdating.swift +++ b/Sources/MapLibreSwiftUI/Extensions/MapLibre/MLNMapViewCameraUpdating.swift @@ -3,6 +3,7 @@ import Foundation import MapLibre import Mockable +// NOTE: We should eventually mark the entire protocol @MainActor, but Mockable generates some unsafe code at the moment @Mockable protocol MLNMapViewCameraUpdating: AnyObject { @MainActor var userTrackingMode: MLNUserTrackingMode { get set } diff --git a/Sources/MapLibreSwiftUI/MapViewCoordinator.swift b/Sources/MapLibreSwiftUI/MapViewCoordinator.swift index 58dca04..d242491 100644 --- a/Sources/MapLibreSwiftUI/MapViewCoordinator.swift +++ b/Sources/MapLibreSwiftUI/MapViewCoordinator.swift @@ -54,6 +54,10 @@ public class MapViewCoordinator: NSObject { } suppressCameraUpdatePropagation = true + defer { + suppressCameraUpdatePropagation = false + } + switch camera.state { case let .centered(onCoordinate: coordinate, zoom: zoom, pitch: pitch, direction: direction): mapView.userTrackingMode = .none @@ -92,7 +96,6 @@ public class MapViewCoordinator: NSObject { } snapshotCamera = camera - suppressCameraUpdatePropagation = false } // MARK: - Coordinator API - Styles + Layers @@ -247,7 +250,7 @@ extension MapViewCoordinator: MLNMapViewDelegate { return } - // FIXME: CI complains about this being unavailable before iOS 17, despite building on iOS 17.2... This is an epic hack to fix it for now. I can only assume this is an issue with Xcode pre-15.3 + // FIXME: CI complains about MainActor.assumeIsolated being unavailable before iOS 17, despite building on iOS 17.2... This is an epic hack to fix it for now. I can only assume this is an issue with Xcode pre-15.3 Task { @MainActor in updateParentCamera(mapView: mapView, reason: reason) } diff --git a/Sources/MapLibreSwiftUI/StaticLocationManager.swift b/Sources/MapLibreSwiftUI/StaticLocationManager.swift index d6d109e..ecee763 100644 --- a/Sources/MapLibreSwiftUI/StaticLocationManager.swift +++ b/Sources/MapLibreSwiftUI/StaticLocationManager.swift @@ -20,6 +20,7 @@ public final class StaticLocationManager: NSObject, @unchecked Sendable { } } + // TODO: Investigate what this does and document it public var headingOrientation: CLDeviceOrientation = .portrait public var lastLocation: CLLocation { diff --git a/Tests/MapLibreSwiftUITests/Examples/MapControlsTests.swift b/Tests/MapLibreSwiftUITests/Examples/MapControlsTests.swift index 06bd75d..0d087bd 100644 --- a/Tests/MapLibreSwiftUITests/Examples/MapControlsTests.swift +++ b/Tests/MapLibreSwiftUITests/Examples/MapControlsTests.swift @@ -22,6 +22,16 @@ final class MapControlsTests: XCTestCase { } } + func testLogoChangePosition() { + assertView { + MapView(styleURL: demoTilesURL) + .mapControls { + LogoView() + .position(.topLeft) + } + } + } + func testCompassOnly() { assertView { MapView(styleURL: demoTilesURL) diff --git a/Tests/MapLibreSwiftUITests/Examples/__Snapshots__/MapControlsTests/testLogoChangePosition.1.png b/Tests/MapLibreSwiftUITests/Examples/__Snapshots__/MapControlsTests/testLogoChangePosition.1.png new file mode 100644 index 0000000..7bbb8f1 Binary files /dev/null and b/Tests/MapLibreSwiftUITests/Examples/__Snapshots__/MapControlsTests/testLogoChangePosition.1.png differ