I have a map that gets its annotations from a database inside of Firebase.
I have a button that when pressed, should add an annotation, but Isn't doing it. This is also through a ForEach loop. I was hoping to get rid of the loop.
ForEach(annotations) { annotation in
Button {
cityAnnotations.append(City(name: "Annotation", coordinate: CLLocationCoordinate2D(latitude: 34.98223, longitude: 28.29182))
} label: {
Text("Convert and Send!")
}
}
Here is how my annotations are stored;
var cityAnnotations = [
]
I have 2 questions:
How do I populate the map to show the annotations after they've been updated inside of
cityAnnotations? (Right now, they are just showing the ones from when I initially described it)Is there any way for me to do this without the
ForEachloop?