Skip to content

Commit

Permalink
Adopt Swift 6 concurrency norms
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthetechie committed Aug 8, 2024
1 parent 09fa55f commit 6e86c15
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Sources/MapLibreSwiftUI/MLNMapViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/MapLibreSwiftUI/MapViewCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ public class MapViewCoordinator<T: MapViewHostViewController>: 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 {

Check failure on line 353 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)

'assumeIsolated(_:file:line:)' is only available in iOS 17.0 or newer

Check failure on line 353 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)

'assumeIsolated(_:file:line:)' is only available in iOS 17.0 or newer
updateViewPort(mapView: mapView, reason: reason)
}

Expand All @@ -359,7 +359,7 @@ public class MapViewCoordinator<T: MapViewHostViewController>: 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 {

Check failure on line 362 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)

'assumeIsolated(_:file:line:)' is only available in iOS 17.0 or newer

Check failure on line 362 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)

'assumeIsolated(_:file:line:)' is only available in iOS 17.0 or newer
updateParentCamera(mapView: mapView, reason: reason)
}
}
Expand Down

0 comments on commit 6e86c15

Please sign in to comment.