Skip to content

Commit 6e86c15

Browse files
committed
Adopt Swift 6 concurrency norms
1 parent 09fa55f commit 6e86c15

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Sources/MapLibreSwiftUI/MLNMapViewController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import UIKit
33

44
public protocol MapViewHostViewController: UIViewController {
55
associatedtype MapType: MLNMapView
6-
var mapView: MapType { get }
6+
@MainActor var mapView: MapType { get }
77
}
88

99
public final class MLNMapViewController: UIViewController, MapViewHostViewController {
10+
@MainActor
1011
public var mapView: MLNMapView {
1112
view as! MLNMapView
1213
}

Sources/MapLibreSwiftUI/MapViewCoordinator.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ public class MapViewCoordinator<T: MapViewHostViewController>: NSObject, MLNMapV
350350
public func mapView(_ mapView: MLNMapView, regionDidChangeWith reason: MLNCameraChangeReason, animated _: Bool) {
351351
// 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
352352
// TODO: We could put this in regionIsChangingWith if we calculate significant change/debounce.
353-
Task { @MainActor in
353+
MainActor.assumeIsolated {
354354
updateViewPort(mapView: mapView, reason: reason)
355355
}
356356

@@ -359,7 +359,7 @@ public class MapViewCoordinator<T: MapViewHostViewController>: NSObject, MLNMapV
359359
}
360360

361361
// 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
362-
Task { @MainActor in
362+
MainActor.assumeIsolated {
363363
updateParentCamera(mapView: mapView, reason: reason)
364364
}
365365
}

0 commit comments

Comments
 (0)