-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add -mapView:didFinishLoadingStyle: delegate methods #6636
Conversation
@friedbunny, thanks for your PR! By analyzing the history of the files in this pull request, we identified @1ec5, @incanus and @boundsj to be potential reviewers. |
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.
We should add some internal commentary around the fact that the setStyleJSON()
functionality in core performs a reset
on the internal impl->styleURL
, which means this SDK call can come back empty (or whatever the equivalent is in the bindings).
@@ -34,6 +34,7 @@ | |||
|
|||
@interface MGLStyle() | |||
@property (nonatomic, weak) MGLMapView *mapView; | |||
@property (readonly, copy, nullable) NSURL *URL; |
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.
Fine for now, but it would be nice to make this public at some point, especially once we have #6386.
methods. Changes to sources or layers of the current style do not cause this | ||
method to be called. | ||
|
||
This method can be used to initiate runtime styling changes that will be |
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.
We don’t use the term “runtime styling” in API or API documentation. How about “modify the layout or appearance of the current style before the map view is displayed to the user”?
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.
Maybe also emphasize that this is the earliest opportunity to make those changes.
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.
Went with your suggested wording in 335fa5f.
We don’t currently expose any way for the developer to use |
Right, but my point is to catch things later, when we need to expose this and it looks like a simple core wiring but actually breaks the functionality in this PR. |
OK, I’ve added a note to #6386 (comment) to track the expected fallout. I see all the necessary |
|
@@ -92,6 +93,10 @@ - (NSString *)name { | |||
return @(self.mapView.mbglMap->getStyleName().c_str()); | |||
} | |||
|
|||
- (NSURL *)URL { |
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.
What I was thinking of in #6636 (review) is just a comment here, something like:
// note that if `mbglMap->setStyleJSON()` is ever wired up, this can return unexpected results
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.
Unexpected in what sense? The private definition of this property says it’s nullable
. Is there an expectation that URL
will end up returning something in the future that isn’t a URL or null
?
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.
Ah, misunderstood. Carry on! 👍
How’s this for changelogging?
|
There's more than one delegate protocol in the library, so best to mention MGLMapViewDelegate by name. Otherwise, that's perfect. |
Example: <MGLStyle: 0x60800001e0a0; name = "Mapbox Dark", URL = "mapbox://styles/mapbox/dark-v9"> - Adds an internal `URL` property.
335fa5f
to
695358b
Compare
Added changelog entries and squashed back down to the basic commits. |
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.
💯🗳
Fixes #6412 by implementing
-mapView:didFinishLoadingStyle:
delegate methods, made possible at the core level by #6371.Also adds
MGLStyle.description
and a privateMGLStyle.URL
property, which are useful when debugging:/cc @1ec5