diff --git a/Sources/MapLibreSwiftUI/MLNMapViewController.swift b/Sources/MapLibreSwiftUI/MLNMapViewController.swift index 65f3903..c192320 100644 --- a/Sources/MapLibreSwiftUI/MLNMapViewController.swift +++ b/Sources/MapLibreSwiftUI/MLNMapViewController.swift @@ -3,10 +3,11 @@ import UIKit public protocol MapViewHostViewController: UIViewController { associatedtype MapType: MLNMapView - var mapView: MapType { get } + @MainActor var mapView: MapType { get } } public final class MLNMapViewController: UIViewController, MapViewHostViewController { + @MainActor public var mapView: MLNMapView { view as! MLNMapView } diff --git a/Sources/MapLibreSwiftUI/MapViewCoordinator.swift b/Sources/MapLibreSwiftUI/MapViewCoordinator.swift index 52051df..967b973 100644 --- a/Sources/MapLibreSwiftUI/MapViewCoordinator.swift +++ b/Sources/MapLibreSwiftUI/MapViewCoordinator.swift @@ -350,7 +350,7 @@ public class MapViewCoordinator: NSObject, MLNMapV public func mapView(_ mapView: MLNMapView, regionDidChangeWith reason: MLNCameraChangeReason, animated _: Bool) { // 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 // TODO: We could put this in regionIsChangingWith if we calculate significant change/debounce. - Task { @MainActor in + MainActor.assumeIsolated { updateViewPort(mapView: mapView, reason: reason) } @@ -359,7 +359,7 @@ public class MapViewCoordinator: NSObject, MLNMapV } // 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 + MainActor.assumeIsolated { updateParentCamera(mapView: mapView, reason: reason) } }