Skip to content

Commit

Permalink
PR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthetechie committed Mar 19, 2024
1 parent 1c321e6 commit 879bd06
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
7 changes: 5 additions & 2 deletions Sources/MapLibreSwiftUI/MapViewCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -92,7 +96,6 @@ public class MapViewCoordinator: NSObject {
}

snapshotCamera = camera
suppressCameraUpdatePropagation = false
}

// MARK: - Coordinator API - Styles + Layers
Expand Down Expand Up @@ -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)

Check warning on line 255 in Sources/MapLibreSwiftUI/MapViewCoordinator.swift

View workflow job for this annotation

GitHub Actions / test (MapLibreSwiftUI-Package, platform=iOS Simulator,name=iPhone 15,OS=17.2)

capture of 'self' with non-sendable type 'MapViewCoordinator' in a `@Sendable` closure

Check warning on line 255 in Sources/MapLibreSwiftUI/MapViewCoordinator.swift

View workflow job for this annotation

GitHub Actions / test (MapLibreSwiftUI-Package, platform=iOS Simulator,name=iPhone 15,OS=17.2)

capture of 'self' with non-sendable type 'MapViewCoordinator' in a `@Sendable` closure
}
Expand Down
1 change: 1 addition & 0 deletions Sources/MapLibreSwiftUI/StaticLocationManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 10 additions & 0 deletions Tests/MapLibreSwiftUITests/Examples/MapControlsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ final class MapControlsTests: XCTestCase {
}
}

func testLogoChangePosition() {
assertView {
MapView(styleURL: demoTilesURL)
.mapControls {
LogoView()
.position(.topLeft)
}
}
}

func testCompassOnly() {
assertView {
MapView(styleURL: demoTilesURL)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 879bd06

Please sign in to comment.