I am trying to make it so that every time I click on my map annotation the corresponding view will come up but it doesn't seem to be the case. It looks like it's all mixed around and sometimes having the same view show up multiple times. This is the code I have so far:
Map(coordinateRegion: $region, interactionModes: .all, showsUserLocation: true, userTrackingMode: nil, annotationItems: sclocations) { item in
MapAnnotation(coordinate: item.location) {
Button(action: {
self.activeSheet = .sheetA
}, label: {
Image(systemName: "mappin")
.foregroundColor(.red)
}) //: BUTTON
.sheet(item: $activeSheet) { sheet in
switch sheet {
case .sheetA:
SCDetailView(sclocations: item)
}
}
}
}