StuckForAges
StuckForAges

Reputation: 11

How can I implement interactive annotations on a map with MapKit in SwiftUI for visionOS?

I'm trying to make interactive annotations on a Map with MapKit and everything works fine on iOS 17. The only issue I have is that on visionOS, the tap gesture is not being recognised, so I when I click on an annotation nothing happens. I'm only testing with the Simulator since I do not have an actual Vision Pro.

Creating a basic Map with Annotations but when I press on an annotation in the Vision Pro Simulator, nothing happens/is printed out; also tried it with having a popover or sheet but it just doesn't work:

Map() {
   ForEach(annotations) { annotation in 
       Annotation(annotation.name, coordinate: ...) {
           Button {
                print("Annotation pressed)
           } label: {
               // Image for annotation
           }
       }
   }
}

Upvotes: 1

Views: 100

Answers (0)

Related Questions