Sham Dhiman
Sham Dhiman

Reputation: 1566

MGLMapViewDelegate Not working in the V10.2.0 SwiftUI

I have implemented the MapBox v6.3.0. Currently i'm updating the MapBox to latest version with V10.2.0. In the latest version MapBox delegate update with events. i have added all events according to previous MGLMapViewDelegate delegate methods. But MapBox events not working properly as MGLMapViewDelegate delegate.

v6.3.0 Delegates:-

func mapView(_ mapView: MGLMapView, didSelect annotationView: MGLAnnotationView) 
func mapView(_ mapView: MGLMapView, didUpdate userLocation: MGLUserLocation?) 
func mapView(_ mapView: MGLMapView, didFailToLocateUserWithError error: Error) 
func mapView(_ mapView: MGLMapView, annotationCanShowCallout annotation: MGLAnnotation)
func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) 

v10.2.0 Events:-

mapView.mapboxMap.onEvery(.styleDataLoaded)
mapView.mapboxMap.onNext(.mapLoaded)
mapView.mapboxMap.onNext(.mapLoadingError)

Question: Can someone please explain to me about the delegate i'm doing lot of search about it on the MapBox official website, but not getting information properly.

Any help would be greatly appreciated.

Thanks in advance.

Upvotes: 4

Views: 664

Answers (1)

swiftyboi
swiftyboi

Reputation: 3221

Couldn't find any documentation on it, but they moved to a subscriber approach:

self.mapView.mapboxMap.onEvery(.mapLoaded) { delegate in
    print("The map has loaded")
}

Upvotes: 1

Related Questions