Skip to content

Commit

Permalink
Merge pull request #45 from stadiamaps/swift6-concurrency
Browse files Browse the repository at this point in the history
Adopt Swift 6 concurrency norms
  • Loading branch information
ianthetechie authored Aug 9, 2024
2 parents 09fa55f + 839f92d commit 8be5051
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Test

on:
push:
branches: [ "*" ]
branches: [ main ]
pull_request:
branches: [ main ]

Expand All @@ -29,7 +29,7 @@ jobs:
]
destination: [
# TODO: Add more destinations
'platform=iOS Simulator,name=iPhone 15,OS=17.2'
'platform=iOS Simulator,name=iPhone 15,OS=17.5'
]

steps:
Expand All @@ -38,7 +38,7 @@ jobs:

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.2'
xcode-version: '15.4'

- name: Checkout maplibre-swiftui-dsl-playground
uses: actions/checkout@v4
Expand Down
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
12 changes: 4 additions & 8 deletions Sources/MapLibreSwiftUI/MapViewCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -348,18 +348,14 @@ public class MapViewCoordinator<T: MapViewHostViewController>: NSObject, MLNMapV

/// The MapView's region has changed with a specific reason.
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)
}

guard !suppressCameraUpdatePropagation else {
return
}
guard !suppressCameraUpdatePropagation else {
return
}

// 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)
}
}
Expand Down

0 comments on commit 8be5051

Please sign in to comment.