Post

Replies

Boosts

Views

Activity

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         }     } }
0
0
322
Mar ’23
Remove polyline layer before presenting a new one
Hi, I use polylines, and tested it with IOS 13.5 - 14.3 to display my routes on the map. If I want to show a new route I delete the previous route. The polyline has then disappeared from the map, but as soon as a new route is drawn, the old route reappears and is visible together with the new route. It is not possible to really remove a polyline or overlay. I tried several solutions that I found all over, but nothings works. I can't continue developing my app because of this bug. I hope you Apple can help me out. func drawPolyline(with coordinates: [CLLocationCoordinate2D], isNeedToCenter: Bool = false, animated: Bool = false) { // Get the all overlays from map view if let overlays = mapView?.overlays { for overlay in overlays { // remove all MKPolyline-Overlays if overlay is MKPolyline { print("Found it") mapView?.removeOverlay(overlay) } } } polylineRoute = MKPolyline(coordinates: coordinates, count: coordinates.count) self.mapView.addOverlay(polylineRoute) }
1
0
1k
Jan ’21