aboutsummaryrefslogtreecommitdiff
path: root/iosApp/iosApp/Map/MapView.swift
diff options
context:
space:
mode:
Diffstat (limited to 'iosApp/iosApp/Map/MapView.swift')
-rw-r--r--iosApp/iosApp/Map/MapView.swift14
1 files changed, 11 insertions, 3 deletions
diff --git a/iosApp/iosApp/Map/MapView.swift b/iosApp/iosApp/Map/MapView.swift
index e52c034..84bdc05 100644
--- a/iosApp/iosApp/Map/MapView.swift
+++ b/iosApp/iosApp/Map/MapView.swift
@@ -25,12 +25,15 @@ struct MapView: UIViewControllerRepresentable {
@Binding var layer: MapLayer
@Binding var markers: [Marker]
+ @Binding var geofences: [Geofence]
@Binding var selected: Marker?
+ var isReport: Bool = false
var markerCallback: MarkerCallback?
class Coordinator {
var shouldCenter: Bool = true
var oldMarkers: [Marker] = []
+ var oldGeofences: [Geofence] = []
}
func makeCoordinator() -> Coordinator {
@@ -50,14 +53,19 @@ struct MapView: UIViewControllerRepresentable {
// MARK: - Set markers
if context.coordinator.oldMarkers != markers {
- print("center = \(context.coordinator.shouldCenter)")
uiViewController.display(markers: markers,
- isReport: false,
+ isReport: isReport,
center: context.coordinator.shouldCenter)
- context.coordinator.shouldCenter = false
+ context.coordinator.shouldCenter = false || isReport
}
context.coordinator.oldMarkers = markers
+ // MARK: - Set geofences
+ if context.coordinator.oldGeofences != geofences {
+ uiViewController.display(geofences: geofences)
+ }
+ context.coordinator.oldGeofences = geofences
+
// MARK: - Center selected marker
if let selected = selected {
uiViewController.focusOn(marker: selected)