Hundley
Hundley

Reputation: 3587

MKLookAroundViewController on macOS - navigation not working

I'm trying to display an interactive LookAround map view in a macOS app - exactly like the native Maps app.

I use MKLookAroundViewController, but it only renders a static image - with no overlays or any ability to interact with the scene. Example code:

class ViewController: NSViewController {
    
    let lookAroundVC = MKLookAroundViewController()
    let coordinates = CLLocationCoordinate2D(latitude: 37.795115, longitude: -122.402845)

    override func viewDidLoad() {
        super.viewDidLoad()
        Task {
            addChild(lookAroundVC)
            view.addSubview(lookAroundVC.view)
            lookAroundVC.view.frame = view.bounds
            lookAroundVC.isNavigationEnabled = true
            lookAroundVC.scene = try? await MKLookAroundSceneRequest(coordinate: coordinates).scene
        }
    }

}

Navigation seems to work fine on iOS, but not on macOS. Any ideas why? The docs don't mention anything about limited functionality.

Upvotes: 0

Views: 26

Answers (0)

Related Questions