diff options
Diffstat (limited to 'iosApp/iosApp/Map/MapViewController.swift')
-rw-r--r-- | iosApp/iosApp/Map/MapViewController.swift | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/iosApp/iosApp/Map/MapViewController.swift b/iosApp/iosApp/Map/MapViewController.swift index 32c21cf..bc793e2 100644 --- a/iosApp/iosApp/Map/MapViewController.swift +++ b/iosApp/iosApp/Map/MapViewController.swift @@ -63,7 +63,7 @@ class MapViewController: UIViewController { mapView.setLoader(loader) } - DispatchQueue.main.async { + mapView.runOnInit { let point = MaplyCoordinateMakeWithDegrees(-100.36, 23.191) self.mapView.setPosition(point, height: 0.4) } @@ -135,23 +135,13 @@ extension MapViewController: MaplyViewControllerDelegate { } class OurMaplyViewController: MaplyViewController { - enum Action { - case zoomIn - case zoomOut - } - private var loader: MaplyQuadImageLoader? = nil private var objects = [MaplyComponentObject]() private var geofenceObjects = [MaplyComponentObject]() - func action(_ action: Action) { - DispatchQueue.main.async { - switch action { - case .zoomIn: - self.zoomIn() - case .zoomOut: - self.zoomOut() - } + func runOnInit(callback: @escaping () -> ()) { + addPostInitBlock { + callback() } } |