Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PointAnnotation not displaying in SwiftUI #2227

Closed
oreillyjf opened this issue Aug 16, 2024 · 2 comments
Closed

PointAnnotation not displaying in SwiftUI #2227

oreillyjf opened this issue Aug 16, 2024 · 2 comments
Labels
bug 🪲 Something is broken!

Comments

@oreillyjf
Copy link

Environment

  • Xcode version: 15.4
  • iOS version: 17.2
  • Devices affected: Simulator
  • Maps SDK Version: 11.6.0

I'm likely missing something basic but the annotation below is not displaying for some reason. It seems from docs that this is all that should be needed?

 struct ContentView: View {
     @State var center = CLLocationCoordinate2D(latitude: 39.5, longitude: -98.0)

     var body: some View {
         Map(initialViewport: .camera(center: center, zoom: 10)) {
             PointAnnotation(coordinate: center)
         }
     }
 }
@oreillyjf oreillyjf added the bug 🪲 Something is broken! label Aug 16, 2024
@oreillyjf
Copy link
Author

Ok, looks like you need to provide .image() .....had thought there was default one that would be used.

@maios
Copy link
Contributor

maios commented Aug 21, 2024

Hi @oreillyjf, we don't have a default image for a PointAnnotation it seems, a point annotation can be displayed with an image, a text, or both, so you need to specify which one to display with

@maios maios closed this as completed Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something is broken!
Projects
None yet
Development

No branches or pull requests

2 participants