Non-sendable type 'MKLookAroundScene

I the this piece of code:

let scene = await getScene(tappedLocation: .init(latitude: tappedLocation.latitude, longitude: tappedLocation.longitude))

I get this warning:

Non-sendable type in my code 'MKLookAroundScene?' returned by call from main actor-isolated context to non-isolated instance method 'getScene(tappedLocation:)' cannot cross actor boundary

Don't know if Xcode Version 14.3 beta (14E5197f) has something to do with this, but I can't get it go away. Who can help me with this?

Thanks in advance.


import SwiftUI



struct MapLookAroundView: UIViewControllerRepresentable {

    typealias UIViewControllerType = MKLookAroundViewController



    @Binding var tappedLocation: CLLocationCoordinate2D?

    @Binding var showLookAroundView: Bool



    func makeUIViewController(context: Context) -> MKLookAroundViewController {

        return MKLookAroundViewController()

    }



    func updateUIViewController(_ uiViewController: MKLookAroundViewController, context: Context) {

        if let tappedLocation {

            Task {

                let scene = await getScene(tappedLocation: .init(latitude: tappedLocation.latitude, longitude: tappedLocation.longitude))



                if scene == nil {

                    withAnimation {

                        self.showLookAroundView = false

                    }

                    return

                }



                withAnimation {

                    self.showLookAroundView = true

                }



                uiViewController.scene = scene

            }

        }

    }



    func getScene(tappedLocation: CLLocationCoordinate2D?) async -> MKLookAroundScene? {

        if let latitude = tappedLocation?.latitude, let longitude = tappedLocation?.longitude {

            let sceneRequest = MKLookAroundSceneRequest(coordinate: .init(latitude: latitude, longitude: longitude))



            do {

                return try await sceneRequest.scene

            } catch {

                return nil

            }

        } else {

            return nil

        }

    }

}
Non-sendable type 'MKLookAroundScene
 
 
Q