-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Version default style URL APIs; deprecate Emerald #4759
Conversation
/** | ||
A version number identifying the latest released version of the suite of default styles provided by Mapbox. This version number may be passed into one of the “StyleURLWithVersion” class methods of MGLStyle. | ||
|
||
The value of this constant is current as of the date on which this SDK was published. Consult the [Mapbox Styles API documentation](https://www.mapbox.com/api-documentation/#styles) for the most up-to-date style versioning information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per #4760, we’ll want to HTML'ize this link.
13851c2
to
61b8409
Compare
|
||
The value of this constant is current as of the date on which this SDK was published. Consult the <a href="https://www.mapbox.com/api-documentation/#styles">Mapbox Styles API documentation</a> for the most up-to-date style versioning information. | ||
|
||
@warning The value of this constant may change in a future release of the SDK. If you use any feature that depends on a specific implementation detail in a default style, you may use the current value of this constant or the underlying style URL, but do not use the constant itself. Such implementation details may change significantly from version to version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me go on the record stating that I think including a MGLStyleCurrentVersion
constant is a trap and that we should require people to explicitly specify a version number.
But it we do include it, we should not use the term "implementation detail" -- this suggests that we don't consider style features to be part of an API contract, when in fact the very reason we are using versions is to indicate changes to documented semantics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of it being used for sanity-checking more than anything. For example, a developer might want to assert in a unit test that the current version is still 9, as a reminder to upgrade the application to use the newest default style with the runtime styling API. We’d avoid using this constant anywhere else in documentation or guides. It’s sort of like how this framework (and all others) provides a MapboxVersionNumber
constant just in case.
But you’re right: the way I’ve worded references to this constant in e.g. -streetsStyleURLWithVersion:
could definitely lead developers to use it without reading this documentation and understanding the ramifications. If we can’t settle on a safer way to treat this constant, I agree that we should make it private.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does 1e3b1f2 look to you? The constant is now MGLStyleDefaultVersion
, with documentation that positions it as “here’s what MGLMapView chooses by default” rather than “here’s what you should pass into MGLStyle”. There are no public references to this constant; instead, documentation for each method spells out the current version “as of publication”, and a unit test verifies that it’s in sync with the constant.
61b8409
to
c2dee9b
Compare
Android equivalent targeting to merge with this PR in #4812 |
Android equivalent was merged with this PR in #4812 |
3edf00d
to
1571a42
Compare
As long as everything checks out, I’m going to branch off the v3.2.1 tag and cherry-pick these changes into that branch (or at least everything that fits after resolving conflicts), then release v3.2.2 from that branch. |
This looks good to me and works in practice (merged into a local v3.2.1 branch), even if the new styles aren’t available yet.
|
Running
|
1e3b1f2
to
fac8530
Compare
Just fixed and rebased. Thanks! |
Cherry-picked the changes into the release-ios-v3.2.2 branch as |
Updated default styles from v8 to v9. Deprecated the MGLMapView class methods in favor of new methods that take a version parameter. Deprecated Emerald outright in favor of Outdoors. Replaced usage of the unversioned MGLStyle methods with the corresponding versioned methods and MGLStyleCurrentVersion to ensure consistency. Expanded MGLStyle unit tests to also assert that MGLStyle has the right number of style URL methods and that they’re all public. Linked the OS X SDK unit test bundle to libmbgl-core.a. Removed an unnecessary dependency on osxapp. Replaced Emerald with Outdoors in iosapp and osxapp. Fixes the iOS and OS X side of #4577 and #4702.
…nition in favour versioned styling methods.
The style ID has also changed, but the unversioned method will continue to point to the old v8 style ID.
Renamed MGLStyleCurrentVersion to MGLStyleDefaultVersion to emphasize the constant’s role as an indicator of the default version used by SDK classes, which may be behind depending on release schedules. In the documentation for each style URL method, include the actual version number instead of the constant. In unit tests, verify that this documentation is in sync with the constant. Link each style URL method’s documentation to a forthcoming webpage on mapbox.com that describes the style in rich detail.
Revised style descriptions to be more consistent with how the styles are described on www.mapbox.com.
58283e7
to
5035dc8
Compare
Updated default styles from v8 to v9 in the centralized default style constants used by the iOS and OS X SDKs as well as by the GLFW application. Deprecated the MGLMapView class methods in favor of new methods that take a version parameter. Replaced usage of the unversioned MGLStyle methods with the corresponding versioned methods and MGLStyleCurrentVersion to ensure consistency.
Expanded MGLStyle unit tests to also assert that MGLStyle has the right number of versioned style URL methods and that they’re all public.
Fixes #4577 and fixes #4702. Hold until the v9 styles near release.
/cc @jfirebaugh @friedbunny