-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Provide "mapType"-like abstraction for built-in styles #1640
Comments
I’d be comfortable requiring developers to pass a simple string into Hybrid is a bit trickier, however, since you need to set style classes, and we’d want to avoid digressing into a discussion of style classes just to set up hybrid. In #935, we implemented a shortcut so that passing |
@1ec5 Any sort of tokenization of the asset URL for our styles would be great, it doesn't necessarily have to exactly resemble MapKit/Google — though Definitely necessary for hybrid to be abstracted, yeah. We should also provide a help topic/FAQ for how it's implemented with style classes, which is a powerful feature that isn't immediately obvious. I was thinking about this larger issue today because of friedbunny/treble@0b491cc, where I wanted to compare the current map style in the three maps and set the status bar style based on the map style (satellite/hybrid/dark get white text). As with the three different |
Thinking more about this, the consistent semantics of I do think a key point here is the discoverability of public-header constants — it'd be friendly to be able to autocomplete |
I think |
It's unusual for an iOS framework to expect a developer to use literal URLs this way for preset options. For a select group of styles we want all developers to know about and have access to, we should provide constants that map to mapbox:// URL strings (if not the URLs themselves). This would be consistent with how UIKit provides constant strings for things like standardized dictionary keys. For any custom styles, the developer would construct their own URLs as usual. |
The upshot is that we would have no additional APIs to maintain, just a list of styles in a header that could be generated at build time if need be. |
@1ec5 @jfirebaugh What about something along the lines of what I am going to do for #2500 in Android? Basically the SDK will expose a set of static String values, currently set to the correct The developer then feeds one of them into Main advantages:
|
@1ec5 I'm also dropping styleId on Android (never got implemented but did have a ticket open) in favour of clear documentation of the |
In the iOS SDK,
This is essentially what I’m proposing for the iOS SDK, though I’m undecided as to which type would be more elegant:
|
Yeah moving to IB would make both APIs parity and stop people getting confused as to which method to use. @1ec5 what about a static method that returns a NSURL? I don't really know much about Apple land so that might sound silly. |
That would be unfortunate, but maybe necessary if we provide NSURLs instead of strings. |
We essentially got this #2746. |
MapKit and Google Maps both specify enumerate type constants for map styles, which makes setting and comparing trivial. I think MBGL should provide a similar abstraction for built-in styles.
We currently ask developers to implement their own style infrastructure, even for built-in styles:
The text was updated successfully, but these errors were encountered: