mapbox-navigation-ios icon indicating copy to clipboard operation
mapbox-navigation-ios copied to clipboard

Standalone and NavigationMapView inside NavigationViewController should use the same styleURL.

Open MaximAlien opened this issue 5 years ago • 2 comments

Currently when creating standalone NavigationMapView styleURL is set to mapbox://styles/mapbox/streets-v11. In case when creating NavigationViewController NavigationMapView sets styleURL to mapbox://styles/mapbox-map-design/ckd6dqf981hi71iqlyn3e896y.

In both cases the same styleURL should be used, which is navigationDayStyleURL.

MaximAlien avatar Aug 18 '20 23:08 MaximAlien

So far, we’ve rationalized this inconsistency by treating the navigation style default as one of the niceties that comes out of the box when using NavigationViewController. It’s trivial for a developer to set the style independently, but admittedly it’s a step that’s easy to overlook. Indeed, even the example application in this repository is somehow still using the Streets style.

More consistency would be nice, but I think it would be fairly tricky to implement. NavigationMapView is merely a subclass of MGLMapView, which allows the developer to set the style URL by passing it into init(frame:styleURL:), decoding it from an archived object, or setting the Style URL inspectable property in Interface Builder. In the inspectable case, the style URL doesn’t get applied until an arbitrary moment after decoding but before appearing.

For now, let’s encourage developers using a standalone NavigationMapView to consider using it in conjunction with a StyleManager, which can not only default to a navigation style but also default to the day or night style as appropriate.

1ec5 avatar Aug 19 '20 23:08 1ec5

Hey, noob here. Is there any documentation on how to use style manager for the standalone map?

In my set up, I have defined a navigation map view that is shown before presenting the navigation view controller (alias standalone map). I applied custom styles that conform to DayStyle and NightStyle (alias StyleManager?) that are passed to the navigation view controller but these changes do not affect the standalone.

I'm aware that I can change the standalone map style by using .mapboxMap.loadStyleURI() but this does not dynamically conform to day and night modes.

Alternatively, I noticed that a previewMapStyleURL is customizable in style manager. Documentation describes this as "URL of the style to display on the map when previewing a route." I think being able to access the preview map could potentially replace my standalone map especially if preview map can also act as my map view for other use cases such as search/annotations.

samuelalake avatar Aug 10 '23 10:08 samuelalake