Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[ios, macos] Document when it's safe to call runtime styling functions (
Browse files Browse the repository at this point in the history
#7335)

* Add notes to wait for map to finish loading before adding sources or layers

* Move style loading notes to class documentation
  • Loading branch information
ericrwolfe authored and 1ec5 committed Dec 18, 2016
1 parent e3a6857 commit e2fde9c
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions platform/darwin/src/MGLStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,24 @@ NS_ASSUME_NONNULL_BEGIN
static const NSInteger MGLStyleDefaultVersion = 9;

/**
The proxy object for the current map style for customization purposes and a
set of convenience methods for creating style URLs of default styles provided
by Mapbox.
The proxy object for the current map style.
MGLStyle provides a set of convenience methods for changing Mapbox
default styles using `-[MGLMapView styleURL]`.
<a href="https://www.mapbox.com/maps/">Learn more about Mapbox default styles</a>.
It is also possible to directly manipulate the current map style
via `-[MGLMapView style]` by updating the style's data sources or layers.
@note Wait until the map style has finished loading before modifying a map's
style via any of the MGLStyle instance methods below.
You can use the `MGLMapViewDelegate` methods `-mapViewDidFinishLoadingMap:`
or `-mapView:didFinishLoadingStyle:` as indicators that it's safe
to modify the map's style.
*/
@interface MGLStyle : NSObject

#pragma mark Accessing Common Styles
#pragma mark Accessing Default Styles

/**
Returns the URL to version 8 of the
Expand Down Expand Up @@ -199,8 +209,8 @@ static const NSInteger MGLStyleDefaultVersion = 9;

/**
Adds a new source to the current style.
@note Adding the same source instance more than once will result in a
@note Adding the same source instance more than once will result in a
`MGLRedundantSourceException`. Reusing the same source identifier, even with
different source instances, will result in a
`MGLRedundantSourceIdentifierException`.
Expand Down Expand Up @@ -251,7 +261,7 @@ static const NSInteger MGLStyleDefaultVersion = 9;

/**
Adds a new layer on top of existing layers.
@note Adding the same layer instance more than once will result in a
`MGLRedundantLayerException`. Reusing the same layer identifer, even with
different layer instances, will also result in an exception.
Expand Down

0 comments on commit e2fde9c

Please sign in to comment.