Skip to content

Commit 8be5051

Browse files
authored
Merge pull request maplibre#45 from stadiamaps/swift6-concurrency
Adopt Swift 6 concurrency norms
2 parents 09fa55f + 839f92d commit 8be5051

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Test
22

33
on:
44
push:
5-
branches: [ "*" ]
5+
branches: [ main ]
66
pull_request:
77
branches: [ main ]
88

@@ -29,7 +29,7 @@ jobs:
2929
]
3030
destination: [
3131
# TODO: Add more destinations
32-
'platform=iOS Simulator,name=iPhone 15,OS=17.2'
32+
'platform=iOS Simulator,name=iPhone 15,OS=17.5'
3333
]
3434

3535
steps:
@@ -38,7 +38,7 @@ jobs:
3838

3939
- uses: maxim-lobanov/setup-xcode@v1
4040
with:
41-
xcode-version: '15.2'
41+
xcode-version: '15.4'
4242

4343
- name: Checkout maplibre-swiftui-dsl-playground
4444
uses: actions/checkout@v4

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: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -348,18 +348,14 @@ public class MapViewCoordinator<T: MapViewHostViewController>: NSObject, MLNMapV
348348

349349
/// The MapView's region has changed with a specific reason.
350350
public func mapView(_ mapView: MLNMapView, regionDidChangeWith reason: MLNCameraChangeReason, animated _: Bool) {
351-
// 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
352351
// TODO: We could put this in regionIsChangingWith if we calculate significant change/debounce.
353-
Task { @MainActor in
352+
MainActor.assumeIsolated {
354353
updateViewPort(mapView: mapView, reason: reason)
355-
}
356354

357-
guard !suppressCameraUpdatePropagation else {
358-
return
359-
}
355+
guard !suppressCameraUpdatePropagation else {
356+
return
357+
}
360358

361-
// 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
363359
updateParentCamera(mapView: mapView, reason: reason)
364360
}
365361
}

0 commit comments

Comments
 (0)