try this maybe it will help
struct LazyView<Content: View>: View {
let build: () -> Content
init(_ build: @autoclosure @escaping () -> Content) {
self.build = build
}
var body: Content {
build()
}
}
LazyView(
MapAnnotation(coordinate: CLLocationCoordinate2D(latitude: mark.lat, longitude: mark.long)) {
Button {withAnimation {
self.selectedGymUid = Int(mark.uid)
}} label: {RoundedGymIconOnMapView(name:mark.name)
.clipShape(Circle())
.overlay(Circle().stroke(selectedGymUid == Int(mark.uid) ? Color(.green).opacity(0.5) : AppColor.shared.joggingColor.opacity(0.5),lineWidth: 1.4))
.scaleEffect(selectedGymUid == Int(mark.uid) ? 2 : 1)
.shadow(radius: 5) }
}
)