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

Annotations won't update if there is another @State var on the UI #5

Open
bilics opened this issue Mar 19, 2020 · 0 comments
Open

Annotations won't update if there is another @State var on the UI #5

bilics opened this issue Mar 19, 2020 · 0 comments

Comments

@bilics
Copy link

bilics commented Mar 19, 2020

Hi @fabian-guerra!

Can you please clarify something:

Mapbox stops updating (calling func updateUIView()) when for any new added annotation when a Text("\(annotations.count)") is added above the MapView() call like bellow:

VStack {
         Text("\(annotations.count)")
         MapView(annotations: $annotations).centerCoordinate(.init(latitude: 37.791293, longitude: -122.396324)).zoomLevel(16)
         Button(action: {
                self.annotations.append( MGLPointAnnotation(title: "Mapbox 1", coordinate: .init(latitude: 37.791400, longitude: -122.396200)))
            }) {
                Text("Add annotation")
            }
...
}

Does this have to do with the SwiftUI propagation and new UI update pattern? Or am I doing something wrong?

Thanks for any insights (or for pointing out what I am doing wrong).

Best regards,

ps.: I commented this problem here #3 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant