summaryrefslogtreecommitdiff
path: root/platform/darwin
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin')
-rwxr-xr-xplatform/darwin/scripts/generate-style-code.js5
-rw-r--r--platform/darwin/scripts/style-spec-overrides-v8.json32
-rw-r--r--platform/darwin/src/MGLAnnotation.h6
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.h10
-rw-r--r--platform/darwin/src/MGLFeature.h15
-rw-r--r--platform/darwin/src/MGLFillExtrusionStyleLayer.h5
-rw-r--r--platform/darwin/src/MGLFillStyleLayer.h9
-rw-r--r--platform/darwin/src/MGLGeometry.h10
-rw-r--r--platform/darwin/src/MGLHeatmapStyleLayer.h5
-rw-r--r--platform/darwin/src/MGLImageSource.h5
-rw-r--r--platform/darwin/src/MGLLight.h21
-rw-r--r--platform/darwin/src/MGLLight.h.ejs13
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.h9
-rw-r--r--platform/darwin/src/MGLMapCamera.h8
-rw-r--r--platform/darwin/src/MGLMapSnapshotter.h6
-rw-r--r--platform/darwin/src/MGLOfflineStorage.h10
-rw-r--r--platform/darwin/src/MGLPointAnnotation.h7
-rw-r--r--platform/darwin/src/MGLPolygon.h5
-rw-r--r--platform/darwin/src/MGLPolyline.h5
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer.h7
-rw-r--r--platform/darwin/src/MGLRasterTileSource.h5
-rw-r--r--platform/darwin/src/MGLShapeSource.h16
-rw-r--r--platform/darwin/src/MGLStyle.h31
-rw-r--r--platform/darwin/src/MGLStyleLayer.h5
-rw-r--r--platform/darwin/src/MGLStyleLayer.h.ejs16
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.h22
-rw-r--r--platform/darwin/src/MGLTilePyramidOfflineRegion.h5
-rw-r--r--platform/darwin/src/MGLVectorTileSource.h5
-rw-r--r--platform/darwin/src/NSExpression+MGLAdditions.h12
29 files changed, 290 insertions, 20 deletions
diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js
index c4c28c7946..a372943060 100755
--- a/platform/darwin/scripts/generate-style-code.js
+++ b/platform/darwin/scripts/generate-style-code.js
@@ -360,6 +360,10 @@ global.propertyDoc = function (propertyName, property, layerType, kind) {
return doc;
};
+global.propertyExample = function (property) {
+ return property.examples;
+};
+
global.isDataDriven = function (property) {
return property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven';
};
@@ -696,6 +700,7 @@ const layers = _(spec.layer.type.values).map((value, layerType) => {
return {
doc: spec.layer.type.values[layerType].doc,
+ examples: spec.layer.type.values[layerType].examples,
type: layerType,
layoutProperties: _.sortBy(layoutProperties, ['name']),
paintProperties: _.sortBy(paintProperties, ['name']),
diff --git a/platform/darwin/scripts/style-spec-overrides-v8.json b/platform/darwin/scripts/style-spec-overrides-v8.json
index b45f0a9bf5..a5761e9adb 100644
--- a/platform/darwin/scripts/style-spec-overrides-v8.json
+++ b/platform/darwin/scripts/style-spec-overrides-v8.json
@@ -1,33 +1,41 @@
{
- "light-cocoa-doc": "An `MGLLight` object represents the light source for extruded geometries in `MGLStyle`.",
+ "light-cocoa-doc": "An `MGLLight` object represents the light source for extruded geometries in `MGLStyle`.\n\n#### Related examples\nSee the <a href=\"https://www.mapbox.com/ios-sdk/maps/examples/light-example/\">Adjust light of 3D buildings</a> to learn how to create and modify the light source for 3D geometries.",
"light": {
"position": {
- "doc": "Position of the `MGLLight` source relative to lit (extruded) geometries, in a `MGLSphericalPosition` struct [radial coordinate, azimuthal angle, polar angle] where radial indicates the distance from the center of the base of an object to its light, azimuthal indicates the position of the light relative to 0° (0° when `MGLLight.anchor` is set to `MGLLightAnchorViewport` corresponds to the top of the viewport, or 0° when `MGLLight.anchor` is set to `MGLLightAnchorMap` corresponds to due north, and degrees proceed clockwise), and polar indicates the height of the light (from 0°, directly above, to 180°, directly below)."
+ "doc": "Position of the `MGLLight` source relative to lit (extruded) geometries, in a `MGLSphericalPosition` struct [radial coordinate, azimuthal angle, polar angle] where radial indicates the distance from the center of the base of an object to its light, azimuthal indicates the position of the light relative to 0° (0° when `MGLLight.anchor` is set to `MGLLightAnchorViewport` corresponds to the top of the viewport, or 0° when `MGLLight.anchor` is set to `MGLLightAnchorMap` corresponds to due north, and degrees proceed clockwise), and polar indicates the height of the light (from 0°, directly above, to 180°, directly below).",
+ "examples": "See the <a href=\"https://www.mapbox.com/ios-sdk/maps/examples/light-example/\">Adjust light of 3D buildings</a> example to learn how to create and modify the position of value of an `MGLLight` object for 3D geometries."
}
},
"layer": {
"type": {
"values": {
"fill": {
- "doc": "An `MGLFillStyleLayer` is a style layer that renders one or more filled (and optionally stroked) polygons on the map.\n\nUse a fill style layer to configure the visual appearance of polygon or multipolygon features. These features can come from vector tiles loaded by an `MGLVectorTileSource` object, or they can be `MGLPolygon`, `MGLPolygonFeature`, `MGLMultiPolygon`, or `MGLMultiPolygonFeature` instances in an `MGLShapeSource` or `MGLComputedShapeSource` object."
+ "doc": "An `MGLFillStyleLayer` is a style layer that renders one or more filled (and optionally stroked) polygons on the map.\n\nUse a fill style layer to configure the visual appearance of polygon or multipolygon features. These features can come from vector tiles loaded by an `MGLVectorTileSource` object, or they can be `MGLPolygon`, `MGLPolygonFeature`, `MGLMultiPolygon`, or `MGLMultiPolygonFeature` instances in an `MGLShapeSource` or `MGLComputedShapeSource` object.",
+ "examples": "See the <a href=\"https://www.mapbox.com/ios-sdk/maps/examples/select-layer/\">Select a feature within a layer</a> example to learn how to use a `TERNARY` expression to modify the `fillOpacity` of an `MGLFillStyleLayer` object. See the <a href=\"https://www.mapbox.com/ios-sdk/maps/examples/fill-pattern/\">Add a pattern to a polygon</a> example to learn how to use an image to add pattern to the features styled by a `MGLFillStyleLayer`."
},
"fill-extrusion": {
- "doc": "An `MGLFillExtrusionStyleLayer` is a style layer that renders one or more 3D extruded polygons on the map.\n\nUse a fill-extrusion style layer to configure the visual appearance of polygon or multipolygon features. These features can come from vector tiles loaded by an `MGLVectorTileSource` object, or they can be `MGLPolygon`, `MGLPolygonFeature`, `MGLMultiPolygon`, or `MGLMultiPolygonFeature` instances in an `MGLShapeSource` or `MGLComputedShapeSource` object."
+ "doc": "An `MGLFillExtrusionStyleLayer` is a style layer that renders one or more 3D extruded polygons on the map.\n\nUse a fill-extrusion style layer to configure the visual appearance of polygon or multipolygon features. These features can come from vector tiles loaded by an `MGLVectorTileSource` object, or they can be `MGLPolygon`, `MGLPolygonFeature`, `MGLMultiPolygon`, or `MGLMultiPolygonFeature` instances in an `MGLShapeSource` or `MGLComputedShapeSource` object.",
+ "examples": "See the <a href=\"https://www.mapbox.com/ios-sdk/maps/examples/extrusions/\">Display 3D buildings</a> example to learn how to add and style 3D layers on a map."
},
"line": {
- "doc": "An `MGLLineStyleLayer` is a style layer that renders one or more stroked polylines on the map.\n\nUse a line style layer to configure the visual appearance of polyline or multipolyline features. These features can come from vector tiles loaded by an `MGLVectorTileSource` object, or they can be `MGLPolyline`, `MGLPolylineFeature`, `MGLMultiPolyline`, or `MGLMultiPolylineFeature` instances in an `MGLShapeSource` or `MGLComputedShapeSource` object."
+ "doc": "An `MGLLineStyleLayer` is a style layer that renders one or more stroked polylines on the map.\n\nUse a line style layer to configure the visual appearance of polyline or multipolyline features. These features can come from vector tiles loaded by an `MGLVectorTileSource` object, or they can be `MGLPolyline`, `MGLPolylineFeature`, `MGLMultiPolyline`, or `MGLMultiPolylineFeature` instances in an `MGLShapeSource` or `MGLComputedShapeSource` object.",
+ "examples": "See the <a href=\"https://www.mapbox.com/ios-sdk/maps/examples/shape-collection/\">Add multiple shapes from a single shape source</a> example to learn how to add a line to your map using this style layer. See the <a href=\"https://www.mapbox.com/ios-sdk/maps/examples/runtime-add-line/\">Add a line style layer from GeoJSON</a> example to learn how to add and style line data to an `MGLMapView` object at runtime."
},
"symbol": {
- "doc": "An `MGLSymbolStyleLayer` is a style layer that renders icon and text labels at points or along lines on the map.\n\nUse a symbol style layer to configure the visual appearance of feature labels. These features can come from vector tiles loaded by an `MGLVectorTileSource` object, or they can be `MGLShape` or `MGLFeature` instances in an `MGLShapeSource` or `MGLComputedShapeSource` object."
+ "doc": "An `MGLSymbolStyleLayer` is a style layer that renders icon and text labels at points or along lines on the map.\n\nUse a symbol style layer to configure the visual appearance of feature labels. These features can come from vector tiles loaded by an `MGLVectorTileSource` object, or they can be `MGLShape` or `MGLFeature` instances in an `MGLShapeSource` or `MGLComputedShapeSource` object.",
+ "examples": "See the <a href=\"https://www.mapbox.com/ios-sdk/maps/examples/runtime-multiple-annotations/\">Dynamically style interactive points</a> and <a href=\"https://www.mapbox.com/ios-sdk/maps/examples/clustering-with-images/\">Use images to cluster point data</a> examples learn how to style data on your map using this layer."
},
"circle": {
- "doc": "An `MGLCircleStyleLayer` is a style layer that renders one or more filled circles on the map.\n\nUse a circle style layer to configure the visual appearance of point or point collection features. These features can come from vector tiles loaded by an `MGLVectorTileSource` object, or they can be `MGLPointAnnotation`, `MGLPointFeature`, `MGLPointCollection`, or `MGLPointCollectionFeature` instances in an `MGLShapeSource` or `MGLComputedShapeSource` object.\n\nA circle style layer renders circles whose radii are measured in screen units. To display circles on the map whose radii correspond to real-world distances, use many-sided regular polygons and configure their appearance using an `MGLFillStyleLayer` object."
+ "doc": "An `MGLCircleStyleLayer` is a style layer that renders one or more filled circles on the map.\n\nUse a circle style layer to configure the visual appearance of point or point collection features. These features can come from vector tiles loaded by an `MGLVectorTileSource` object, or they can be `MGLPointAnnotation`, `MGLPointFeature`, `MGLPointCollection`, or `MGLPointCollectionFeature` instances in an `MGLShapeSource` or `MGLComputedShapeSource` object.\n\nA circle style layer renders circles whose radii are measured in screen units. To display circles on the map whose radii correspond to real-world distances, use many-sided regular polygons and configure their appearance using an `MGLFillStyleLayer` object.",
+ "examples": "See the <a href=\"https://www.mapbox.com/ios-sdk/maps/examples/dds-circle-layer/\">Data-driven circles</a>, <a href=\"https://www.mapbox.com/ios-sdk/maps/examples/shape-collection/\">Add multiple shapes from a single shape source</a>, and <a href=\"https://www.mapbox.com/ios-sdk/maps/examples/clustering/\">Cluster point data</a> examples to learn how to add circles to your map using this style layer."
},
"heatmap": {
- "doc": "An `MGLHeatmapStyleLayer` is a style layer that renders a <a href=\"https://en.wikipedia.org/wiki/Heat_map\">heatmap</a>.\n\nA heatmap visualizes the spatial distribution of a large, dense set of point data, using color to avoid cluttering the map with individual points at low zoom levels. The points are weighted by an attribute you specify. Use a heatmap style layer in conjunction with point or point collection features. These features can come from vector tiles loaded by an `MGLVectorTileSource` object, or they can be `MGLPointAnnotation`, `MGLPointFeature`, `MGLPointCollection`, or `MGLPointCollectionFeature` instances in an `MGLShapeSource` or `MGLComputedShapeSource` object.\n\nConsider accompanying a heatmap style layer with an `MGLCircleStyleLayer` or `MGLSymbolStyleLayer` at high zoom levels. If you are unsure whether the point data in an `MGLShapeSource` is dense enough to warrant a heatmap, you can alternatively cluster the source using the `MGLShapeSourceOptionClustered` option and render the data using an `MGLCircleStyleLayer` or `MGLSymbolStyleLayer`."
+ "doc": "An `MGLHeatmapStyleLayer` is a style layer that renders a <a href=\"https://en.wikipedia.org/wiki/Heat_map\">heatmap</a>.\n\nA heatmap visualizes the spatial distribution of a large, dense set of point data, using color to avoid cluttering the map with individual points at low zoom levels. The points are weighted by an attribute you specify. Use a heatmap style layer in conjunction with point or point collection features. These features can come from vector tiles loaded by an `MGLVectorTileSource` object, or they can be `MGLPointAnnotation`, `MGLPointFeature`, `MGLPointCollection`, or `MGLPointCollectionFeature` instances in an `MGLShapeSource` or `MGLComputedShapeSource` object.\n\nConsider accompanying a heatmap style layer with an `MGLCircleStyleLayer` or `MGLSymbolStyleLayer` at high zoom levels. If you are unsure whether the point data in an `MGLShapeSource` is dense enough to warrant a heatmap, you can alternatively cluster the source using the `MGLShapeSourceOptionClustered` option and render the data using an `MGLCircleStyleLayer` or `MGLSymbolStyleLayer`.",
+ "examples": "See the <a href=\"https://www.mapbox.com/ios-sdk/maps/examples/heatmap-example/\">Create a heatmap layer</a> example to learn how to add this style layer to your map."
},
"raster": {
- "doc": "An `MGLRasterStyleLayer` is a style layer that renders georeferenced raster imagery on the map, especially raster tiles.\n\nUse a raster style layer to configure the color parameters of raster tiles loaded by an `MGLRasterTileSource` object or raster images loaded by an `MGLImageSource` object. For example, you could use a raster style layer to render <a href=\"https://www.mapbox.com/satellite/\">Mapbox Satellite</a> imagery, a <a href=\"https://www.mapbox.com/help/define-tileset/#raster-tilesets\">raster tile set</a> uploaded to Mapbox Studio, or a raster map authored in <a href=\"https://tilemill-project.github.io/tilemill/\">TileMill</a>, the classic Mapbox Editor, or Mapbox Studio Classic.\n\nRaster images may also be used as icons or patterns in a style layer. To register an image for use as an icon or pattern, use the `-[MGLStyle setImage:forName:]` method. To configure a point annotation’s image, use the `MGLAnnotationImage` class."
+ "doc": "An `MGLRasterStyleLayer` is a style layer that renders georeferenced raster imagery on the map, especially raster tiles.\n\nUse a raster style layer to configure the color parameters of raster tiles loaded by an `MGLRasterTileSource` object or raster images loaded by an `MGLImageSource` object. For example, you could use a raster style layer to render <a href=\"https://www.mapbox.com/satellite/\">Mapbox Satellite</a> imagery, a <a href=\"https://www.mapbox.com/help/define-tileset/#raster-tilesets\">raster tile set</a> uploaded to Mapbox Studio, or a raster map authored in <a href=\"https://tilemill-project.github.io/tilemill/\">TileMill</a>, the classic Mapbox Editor, or Mapbox Studio Classic.\n\nRaster images may also be used as icons or patterns in a style layer. To register an image for use as an icon or pattern, use the `-[MGLStyle setImage:forName:]` method. To configure a point annotation’s image, use the `MGLAnnotationImage` class.",
+ "examples": "See the <a href=\"https://www.mapbox.com/ios-sdk/maps/examples/image-source/\">Add an image</a> and <a href=\"https://www.mapbox.com/ios-sdk/maps/examples/source-custom-raster/\">Add raster imagery</a> examples to learn how to add imagery with this style layer."
},
"hillshade": {
"doc": "An `MGLHillshadeStyleLayer` is a style layer that renders raster <a href=\"https://en.wikipedia.org/wiki/Digital_elevation_model\">digital elevation model</a> (DEM) tiles on the map.\n\nUse a hillshade style layer to configure the color parameters of raster tiles loaded by an `MGLRasterDEMSource` object. For example, you could use a hillshade style layer to render <a href=\"https://www.mapbox.com/help/access-elevation-data/#mapbox-terrain-rgb\">Mapbox Terrain-RGB</a> data.\n\nTo display posterized hillshading based on vector shapes, as with the <a href=\"https://www.mapbox.com/vector-tiles/mapbox-terrain/\">Mapbox Terrain</a> source, use an `MGLVectorTileSource` object in conjunction with several `MGLFillStyleLayer` objects."
@@ -56,10 +64,12 @@
"doc": "Offset distance of icon from its anchor."
},
"icon-image": {
- "doc": "Name of a style image to use for drawing an image background.\n\nUse the `+[MGLStyle setImage:forName:]` method to associate an image with a name that you can set this property to.\n\nWithin a constant string value, a feature attribute name enclosed in curly braces (e.g., `{token}`) is replaced with the value of the named attribute. Tokens inside non-constant expressions are ignored; instead, use `mgl_join:` and key path expressions."
+ "doc": "Name of a style image to use for drawing an image background.\n\nUse the `+[MGLStyle setImage:forName:]` method to associate an image with a name that you can set this property to.\n\nWithin a constant string value, a feature attribute name enclosed in curly braces (e.g., `{token}`) is replaced with the value of the named attribute. Tokens inside non-constant expressions are ignored; instead, use `mgl_join:` and key path expressions.",
+ "examples": "See the <a href=\"https://www.mapbox.com/ios-sdk/maps/examples/clustering-with-images/\">Use images to cluster point data</a> example to learn how to dynamically set your icons with an expression."
},
"text-field": {
- "doc": "Value to use for a text label.\n\nWithin a constant string value, a feature attribute name enclosed in curly braces (e.g., `{token}`) is replaced with the value of the named attribute. Tokens inside non-constant expressions are ignored; instead, use `mgl_join:` and key path expressions."
+ "doc": "Value to use for a text label.\n\nWithin a constant string value, a feature attribute name enclosed in curly braces (e.g., `{token}`) is replaced with the value of the named attribute. Tokens inside non-constant expressions are ignored; instead, use `mgl_join:` and key path expressions.",
+ "examples": "See the <a href=\"https://www.mapbox.com/ios-sdk/maps/examples/clustering/\">Cluster point data</a> and <a href=\"https://www.mapbox.com/ios-sdk/maps/examples/clustering-with-images/\">Use images to cluster point data</a> to learn how to use an expression to set this attribute to the number of markers within a cluster."
},
"text-font": {
"doc": "An array of font face names used to display the text.\n\nEach font name must be included in the `{fontstack}` portion of the JSON stylesheet’s <a href=\"https://www.mapbox.com/mapbox-gl-style-spec/#glyphs\"><code>glyphs</code></a> property. You can register a custom font when designing the style in Mapbox Studio. Fonts installed on the system are not used.\n\nThe first font named in the array is applied to the text. For each character in the text, if the first font lacks a glyph for the character, the next font is applied as a fallback, and so on."
diff --git a/platform/darwin/src/MGLAnnotation.h b/platform/darwin/src/MGLAnnotation.h
index a0a58e83a6..70b0bb178d 100644
--- a/platform/darwin/src/MGLAnnotation.h
+++ b/platform/darwin/src/MGLAnnotation.h
@@ -16,6 +16,12 @@ NS_ASSUME_NONNULL_BEGIN
An object that adopts this protocol must implement the `coordinate` property.
The other methods of this protocol are optional.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/annotation-models/">
+ Annotation models</a> and <a href="https://www.mapbox.com/ios-sdk/maps/examples/annotation-views/">
+ Annotation views</a> examples to learn how to add objects that follow the
+ `MGLAnnotation` protocol.
*/
@protocol MGLAnnotation <NSObject>
diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h
index 69b6e41c9c..4b6a37fb86 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.h
+++ b/platform/darwin/src/MGLCircleStyleLayer.h
@@ -78,6 +78,16 @@ typedef NS_ENUM(NSUInteger, MGLCircleTranslationAnchor) {
new circle style layer and add it to the style using a method such as
`-[MGLStyle addLayer:]`.
+ #### Related examples
+ See the <a
+ href="https://www.mapbox.com/ios-sdk/maps/examples/dds-circle-layer/">Data-driven
+ circles</a>, <a
+ href="https://www.mapbox.com/ios-sdk/maps/examples/shape-collection/">Add
+ multiple shapes from a single shape source</a>, and <a
+ href="https://www.mapbox.com/ios-sdk/maps/examples/clustering/">Cluster point
+ data</a> examples to learn how to add circles to your map using this style
+ layer.
+
### Example
```swift
diff --git a/platform/darwin/src/MGLFeature.h b/platform/darwin/src/MGLFeature.h
index 430bf58f92..8886c8df55 100644
--- a/platform/darwin/src/MGLFeature.h
+++ b/platform/darwin/src/MGLFeature.h
@@ -182,6 +182,11 @@ MGL_EXPORT
/**
An `MGLPointFeature` object associates a point shape with an optional
identifier and attributes.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/runtime-multiple-annotations/">
+ Dynamically style interactive points</a> example to learn how to initialize
+ `MGLPointFeature` objects and add it them your map.
*/
MGL_EXPORT
@interface MGLPointFeature : MGLPointAnnotation <MGLFeature>
@@ -194,6 +199,11 @@ MGL_EXPORT
A polyline feature is known as a
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.4">LineString</a>
feature in GeoJSON.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/line-geojson/">
+ Add a line annotation from GeoJSON</a> example to learn how to initialize an
+ `MGLPolylineFeature` and add it to an `MGLMapView` object.
*/
MGL_EXPORT
@interface MGLPolylineFeature : MGLPolyline <MGLFeature>
@@ -256,6 +266,11 @@ MGL_EXPORT
A shape collection feature is known as a
<a href="https://tools.ietf.org/html/rfc7946#section-3.3">feature collection</a>
in GeoJSON.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/shape-collection/">
+ Add multiple shapes from a single shape source</a> example to learn how to
+ add shape data to your map using an `MGLShapeCollectionFeature` object.
*/
MGL_EXPORT
@interface MGLShapeCollectionFeature : MGLShapeCollection <MGLFeature>
diff --git a/platform/darwin/src/MGLFillExtrusionStyleLayer.h b/platform/darwin/src/MGLFillExtrusionStyleLayer.h
index 99b3d3ffaf..6e807c1b44 100644
--- a/platform/darwin/src/MGLFillExtrusionStyleLayer.h
+++ b/platform/darwin/src/MGLFillExtrusionStyleLayer.h
@@ -40,6 +40,11 @@ typedef NS_ENUM(NSUInteger, MGLFillExtrusionTranslationAnchor) {
new fill-extrusion style layer and add it to the style using a method such as
`-[MGLStyle addLayer:]`.
+ #### Related examples
+ See the <a
+ href="https://www.mapbox.com/ios-sdk/maps/examples/extrusions/">Display 3D
+ buildings</a> example to learn how to add and style 3D layers on a map.
+
### Example
```swift
diff --git a/platform/darwin/src/MGLFillStyleLayer.h b/platform/darwin/src/MGLFillStyleLayer.h
index eadf57222b..4eaf9b53ba 100644
--- a/platform/darwin/src/MGLFillStyleLayer.h
+++ b/platform/darwin/src/MGLFillStyleLayer.h
@@ -39,6 +39,15 @@ typedef NS_ENUM(NSUInteger, MGLFillTranslationAnchor) {
new fill style layer and add it to the style using a method such as
`-[MGLStyle addLayer:]`.
+ #### Related examples
+ See the <a
+ href="https://www.mapbox.com/ios-sdk/maps/examples/select-layer/">Select a
+ feature within a layer</a> example to learn how to use a `TERNARY` expression
+ to modify the `fillOpacity` of an `MGLFillStyleLayer` object. See the <a
+ href="https://www.mapbox.com/ios-sdk/maps/examples/fill-pattern/">Add a pattern
+ to a polygon</a> example to learn how to use an image to add pattern to the
+ features styled by a `MGLFillStyleLayer`.
+
### Example
```swift
diff --git a/platform/darwin/src/MGLGeometry.h b/platform/darwin/src/MGLGeometry.h
index c3450359aa..997ff285e2 100644
--- a/platform/darwin/src/MGLGeometry.h
+++ b/platform/darwin/src/MGLGeometry.h
@@ -146,7 +146,15 @@ NS_INLINE BOOL MGLCoordinateBoundsIntersectsCoordinateBounds(MGLCoordinateBounds
bounds1.sw.longitude < bounds2.ne.longitude);
}
-/** Returns `YES` if the coordinate is within the coordinate bounds. */
+/**
+ Returns `YES` if the coordinate is within the coordinate bounds.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/constraining-gestures/">
+ Restrict map panning to an area</a> example to learn how to use
+ `MGLCoordinateInCoordinateBounds` to determine if a point is within, or
+ intersects, a given bounding box.
+ */
NS_INLINE BOOL MGLCoordinateInCoordinateBounds(CLLocationCoordinate2D coordinate, MGLCoordinateBounds bounds) {
return (coordinate.latitude >= bounds.sw.latitude &&
coordinate.latitude <= bounds.ne.latitude &&
diff --git a/platform/darwin/src/MGLHeatmapStyleLayer.h b/platform/darwin/src/MGLHeatmapStyleLayer.h
index 167c5bafbe..086f335746 100644
--- a/platform/darwin/src/MGLHeatmapStyleLayer.h
+++ b/platform/darwin/src/MGLHeatmapStyleLayer.h
@@ -32,6 +32,11 @@ NS_ASSUME_NONNULL_BEGIN
new heatmap style layer and add it to the style using a method such as
`-[MGLStyle addLayer:]`.
+ #### Related examples
+ See the <a
+ href="https://www.mapbox.com/ios-sdk/maps/examples/heatmap-example/">Create a
+ heatmap layer</a> example to learn how to add this style layer to your map.
+
### Example
```swift
diff --git a/platform/darwin/src/MGLImageSource.h b/platform/darwin/src/MGLImageSource.h
index 21487d9739..5eac5e21bf 100644
--- a/platform/darwin/src/MGLImageSource.h
+++ b/platform/darwin/src/MGLImageSource.h
@@ -41,6 +41,11 @@ MGL_EXPORT
let source = MGLImageSource(identifier: "radar", coordinateQuad: coordinates, url: URL(string: "https://www.mapbox.com/mapbox-gl-js/assets/radar.gif")!)
mapView.style?.addSource(source)
```
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/image-source/">
+ Add an image</a> example to learn how to add an image to your map using
+ `MGLImageSource`.
*/
MGL_EXPORT
@interface MGLImageSource : MGLSource
diff --git a/platform/darwin/src/MGLLight.h b/platform/darwin/src/MGLLight.h
index 13c925d9bd..52bda1fecd 100644
--- a/platform/darwin/src/MGLLight.h
+++ b/platform/darwin/src/MGLLight.h
@@ -40,11 +40,11 @@ typedef struct __attribute__((objc_boxable)) MGLSphericalPosition {
/**
Creates a new `MGLSphericalPosition` from the given radial, azimuthal, polar.
-
+
@param radial The radial coordinate.
@param azimuthal The azimuthal angle.
@param polar The polar angle.
-
+
@return Returns a `MGLSphericalPosition` struct containing the position attributes.
*/
NS_INLINE MGLSphericalPosition MGLSphericalPositionMake(CGFloat radial, CLLocationDirection azimuthal, CLLocationDirection polar) {
@@ -52,12 +52,19 @@ NS_INLINE MGLSphericalPosition MGLSphericalPositionMake(CGFloat radial, CLLocati
position.radial = radial;
position.azimuthal = azimuthal;
position.polar = polar;
-
+
return position;
}
/**
- An `MGLLight` object represents the light source for extruded geometries in `MGLStyle`.
+ An `MGLLight` object represents the light source for extruded geometries in
+ `MGLStyle`.
+
+ #### Related examples
+ See the <a
+ href="https://www.mapbox.com/ios-sdk/maps/examples/light-example/">Adjust light
+ of 3D buildings</a> to learn how to create and modify the light source for 3D
+ geometries.
*/
MGL_EXPORT
@interface MGLLight : NSObject
@@ -118,6 +125,12 @@ MGL_EXPORT
This property corresponds to the <a
href="https://www.mapbox.com/mapbox-gl-js/style-spec/#light-position"><code>position</code></a>
light property in the Mapbox Style Specification.
+
+ #### Related examples
+ See the <a
+ href="https://www.mapbox.com/ios-sdk/maps/examples/light-example/">Adjust light
+ of 3D buildings</a> example to learn how to create and modify the position of
+ value of an `MGLLight` object for 3D geometries.
*/
@property (nonatomic) NSExpression *position;
diff --git a/platform/darwin/src/MGLLight.h.ejs b/platform/darwin/src/MGLLight.h.ejs
index 56c3312107..30efef7937 100644
--- a/platform/darwin/src/MGLLight.h.ejs
+++ b/platform/darwin/src/MGLLight.h.ejs
@@ -46,11 +46,11 @@ typedef struct __attribute__((objc_boxable)) MGLSphericalPosition {
/**
Creates a new `MGLSphericalPosition` from the given radial, azimuthal, polar.
-
+
@param radial The radial coordinate.
@param azimuthal The azimuthal angle.
@param polar The polar angle.
-
+
@return Returns a `MGLSphericalPosition` struct containing the position attributes.
*/
NS_INLINE MGLSphericalPosition MGLSphericalPositionMake(CGFloat radial, CLLocationDirection azimuthal, CLLocationDirection polar) {
@@ -58,12 +58,12 @@ NS_INLINE MGLSphericalPosition MGLSphericalPositionMake(CGFloat radial, CLLocati
position.radial = radial;
position.azimuthal = azimuthal;
position.polar = polar;
-
+
return position;
}
/**
- <%- doc %>
+ <%- doc.wrap(80, 1) %>
*/
MGL_EXPORT
@interface MGLLight : NSObject
@@ -76,6 +76,11 @@ MGL_EXPORT
This property corresponds to the <a
href="https://www.mapbox.com/mapbox-gl-js/style-spec/#light-<%- originalPropertyName(property) %>"><code><%- originalPropertyName(property) %></code></a>
light property in the Mapbox Style Specification.
+<% if (property.examples) { -%>
+
+ #### Related examples
+<%- propertyExample(property).wrap(80, 1) %>
+<% } -%>
*/
@property (nonatomic<% if (property.getter) { %>, getter=<%- objCGetter(property) -%><% } %>) NSExpression *<%- camelizeWithLeadingLowercase(property.name) %>;
diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h
index ac30ff5f86..beb082d486 100644
--- a/platform/darwin/src/MGLLineStyleLayer.h
+++ b/platform/darwin/src/MGLLineStyleLayer.h
@@ -89,6 +89,15 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslationAnchor) {
new line style layer and add it to the style using a method such as
`-[MGLStyle addLayer:]`.
+ #### Related examples
+ See the <a
+ href="https://www.mapbox.com/ios-sdk/maps/examples/shape-collection/">Add
+ multiple shapes from a single shape source</a> example to learn how to add a
+ line to your map using this style layer. See the <a
+ href="https://www.mapbox.com/ios-sdk/maps/examples/runtime-add-line/">Add a
+ line style layer from GeoJSON</a> example to learn how to add and style line
+ data to an `MGLMapView` object at runtime.
+
### Example
```swift
diff --git a/platform/darwin/src/MGLMapCamera.h b/platform/darwin/src/MGLMapCamera.h
index ec142939ed..061b1e0df1 100644
--- a/platform/darwin/src/MGLMapCamera.h
+++ b/platform/darwin/src/MGLMapCamera.h
@@ -9,6 +9,14 @@ NS_ASSUME_NONNULL_BEGIN
/**
An `MGLMapCamera` object represents a viewpoint from which the user observes
some point on an `MGLMapView`.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/camera-animation/">
+ Camera animation</a> example to learn how to create a camera that rotates
+ around a central point. See the <a href="https://www.mapbox.com/ios-sdk/maps/
+ examples/constraining-gestures/">Restrict map panning to an area</a> example
+ to learn how to restrict map panning using `MGLMapViewDelegate`'s
+ `-mapView:shouldChangeFromCamera:toCamera:` method.
*/
MGL_EXPORT
@interface MGLMapCamera : NSObject <NSSecureCoding, NSCopying>
diff --git a/platform/darwin/src/MGLMapSnapshotter.h b/platform/darwin/src/MGLMapSnapshotter.h
index 8281e2a084..de509f73f4 100644
--- a/platform/darwin/src/MGLMapSnapshotter.h
+++ b/platform/darwin/src/MGLMapSnapshotter.h
@@ -163,6 +163,12 @@ typedef void (^MGLMapSnapshotCompletionHandler)(MGLMapSnapshot* _Nullable snapsh
image = snapshot?.image
}
```
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/map-snapshotter/">
+ Create a static map snapshot</a> example to learn how to use the
+ `MGLMapSnapshotter` to generate a static image based on an `MGLMapView`
+ object's style, camera, and view bounds.
*/
MGL_EXPORT
@interface MGLMapSnapshotter : NSObject
diff --git a/platform/darwin/src/MGLOfflineStorage.h b/platform/darwin/src/MGLOfflineStorage.h
index 387045f845..0b2b5221cf 100644
--- a/platform/darwin/src/MGLOfflineStorage.h
+++ b/platform/darwin/src/MGLOfflineStorage.h
@@ -26,6 +26,11 @@ NS_ASSUME_NONNULL_BEGIN
If you only need to observe changes in a particular pack’s progress, you can
alternatively observe KVO change notifications to the pack’s `progress` key
path.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/offline-pack/">
+ Download an offline map</a> example to learn how to calculate the progress
+ of an offline download.
*/
FOUNDATION_EXTERN MGL_EXPORT const NSNotificationName MGLOfflinePackProgressChangedNotification;
@@ -177,6 +182,11 @@ typedef NS_ENUM(NSUInteger, MGLResourceKind) {
packs. All of this class’s instance methods are asynchronous, reflecting the
fact that offline resources are stored in a database. The shared object
maintains a canonical collection of offline packs in its `packs` property.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/offline-pack/">
+ Download an offline map</a> example to learn how to create and register an
+ offline pack for a defined region.
*/
MGL_EXPORT
@interface MGLOfflineStorage : NSObject
diff --git a/platform/darwin/src/MGLPointAnnotation.h b/platform/darwin/src/MGLPointAnnotation.h
index 3dac7a969c..0543d57691 100644
--- a/platform/darwin/src/MGLPointAnnotation.h
+++ b/platform/darwin/src/MGLPointAnnotation.h
@@ -34,6 +34,13 @@ NS_ASSUME_NONNULL_BEGIN
A point shape is known as a
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.2">Point</a> geometry
in GeoJSON.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/marker/">
+ Mark a place on the map with an annotation</a>, <a href="https://www.mapbox.com/ios-sdk/maps/examples/marker-image/">
+ Mark a place on the map with an image</a>, and <a href="https://www.mapbox.com/ios-sdk/maps/examples/default-callout/">
+ Default callout usage</a> examples to learn how to add `MGLPointAnnotation`
+ objects to your map.
*/
MGL_EXPORT
@interface MGLPointAnnotation : MGLShape
diff --git a/platform/darwin/src/MGLPolygon.h b/platform/darwin/src/MGLPolygon.h
index 810a8b78ae..fcc26e5f16 100644
--- a/platform/darwin/src/MGLPolygon.h
+++ b/platform/darwin/src/MGLPolygon.h
@@ -44,6 +44,11 @@ NS_ASSUME_NONNULL_BEGIN
To make the polygon straddle the antimeridian, specify some longitudes less
than −180 degrees or greater than 180 degrees.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/polygon/">
+ Add a polygon annotation</a> example to learn how to initialize an
+ `MGLPolygon` object from an array of coordinates.
*/
MGL_EXPORT
@interface MGLPolygon : MGLMultiPoint <MGLOverlay>
diff --git a/platform/darwin/src/MGLPolyline.h b/platform/darwin/src/MGLPolyline.h
index 8e9007686b..7b81d41f47 100644
--- a/platform/darwin/src/MGLPolyline.h
+++ b/platform/darwin/src/MGLPolyline.h
@@ -50,6 +50,11 @@ NS_ASSUME_NONNULL_BEGIN
A polyline is known as a
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.4">LineString</a>
geometry in GeoJSON.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/annotation-models/">
+ Annotation models</a> example to learn how to add an `MGLPolyine` object to
+ your map.
*/
MGL_EXPORT
@interface MGLPolyline : MGLMultiPoint <MGLOverlay>
diff --git a/platform/darwin/src/MGLRasterStyleLayer.h b/platform/darwin/src/MGLRasterStyleLayer.h
index a74d4f7f26..cab6db3a91 100644
--- a/platform/darwin/src/MGLRasterStyleLayer.h
+++ b/platform/darwin/src/MGLRasterStyleLayer.h
@@ -52,6 +52,13 @@ typedef NS_ENUM(NSUInteger, MGLRasterResamplingMode) {
new raster style layer and add it to the style using a method such as
`-[MGLStyle addLayer:]`.
+ #### Related examples
+ See the <a
+ href="https://www.mapbox.com/ios-sdk/maps/examples/image-source/">Add an
+ image</a> and <a
+ href="https://www.mapbox.com/ios-sdk/maps/examples/source-custom-raster/">Add
+ raster imagery</a> examples to learn how to add imagery with this style layer.
+
### Example
```swift
diff --git a/platform/darwin/src/MGLRasterTileSource.h b/platform/darwin/src/MGLRasterTileSource.h
index 8f00be0ea4..ee5c80a3e8 100644
--- a/platform/darwin/src/MGLRasterTileSource.h
+++ b/platform/darwin/src/MGLRasterTileSource.h
@@ -52,6 +52,11 @@ FOUNDATION_EXTERN MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionTileSi
])
mapView.style?.addSource(source)
```
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/source-custom-raster/">
+ Add raster imagery</a> example to learn how to add a `MGLRasterStyleLayer`
+ to your map using an `MGLRasterTileSource`.
*/
MGL_EXPORT
@interface MGLRasterTileSource : MGLTileSource
diff --git a/platform/darwin/src/MGLShapeSource.h b/platform/darwin/src/MGLShapeSource.h
index c80c329cbc..edf8c0a174 100644
--- a/platform/darwin/src/MGLShapeSource.h
+++ b/platform/darwin/src/MGLShapeSource.h
@@ -23,6 +23,9 @@ typedef NSString *MGLShapeSourceOption NS_STRING_ENUM;
This option only affects point features within an `MGLShapeSource` object; it
is ignored when creating an `MGLComputedShapeSource` object.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/clustering/">Cluster point data</a> and <a href="https://www.mapbox.com/ios-sdk/maps/examples/clustering-with-images/">Use images to cluster point data</a> examples to learn how to cluster point data with this `MGLShapeSourceOption`.
*/
FOUNDATION_EXTERN MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionClustered;
@@ -142,6 +145,9 @@ FOUNDATION_EXTERN MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionLine
let source = MGLShapeSource(identifier: "lines", features: [polyline], options: nil)
mapView.style?.addSource(source)
```
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/clustering/">Cluster point data</a>, <a href="https://www.mapbox.com/ios-sdk/maps/examples/clustering-with-images/">Use images to cluster point data</a>, and <a href="https://www.mapbox.com/ios-sdk/maps/examples/live-data/">Add live data</a> examples to learn how to add data to your map using this `MGLSource` object.
*/
MGL_EXPORT
@interface MGLShapeSource : MGLSource
@@ -165,6 +171,11 @@ MGL_EXPORT
current application’s resource bundle.
@param options An `NSDictionary` of options for this source.
@return An initialized shape source.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/live-data/">
+ Add live data</a> example to learn how to add live data to your map by
+ updating the an `MGLShapeSource` object's `URL` property.
*/
- (instancetype)initWithIdentifier:(NSString *)identifier URL:(NSURL *)url options:(nullable NSDictionary<MGLShapeSourceOption, id> *)options NS_DESIGNATED_INITIALIZER;
@@ -194,6 +205,11 @@ MGL_EXPORT
@param shape A concrete subclass of `MGLShape`
@param options An `NSDictionary` of options for this source.
@return An initialized shape source.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/runtime-animate-line/">
+ Animate a line</a> example to learn how to animate line data by continously
+ updating an `MGLShapeSource`'s `shape` attribute.
*/
- (instancetype)initWithIdentifier:(NSString *)identifier shape:(nullable MGLShape *)shape options:(nullable NSDictionary<MGLShapeSourceOption, id> *)options NS_DESIGNATED_INITIALIZER;
diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h
index 7b62432d36..fcbd318b18 100644
--- a/platform/darwin/src/MGLStyle.h
+++ b/platform/darwin/src/MGLStyle.h
@@ -52,6 +52,11 @@ FOUNDATION_EXTERN MGL_EXPORT MGLExceptionName const MGLRedundantSourceIdentifier
`-[MGLMapViewDelegate mapView:didFinishLoadingStyle:]` or
`-[MGLMapViewDelegate mapViewDidFinishLoadingMap:]` methods as indicators
that it's safe to modify the map's style.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/default-styles/">
+ Default styles</a> example to learn how to initialize an `MGLMapView` object
+ with a Mapbox default style using `MGLStyle`'s class methods.
*/
MGL_EXPORT
@interface MGLStyle : NSObject
@@ -177,6 +182,11 @@ MGL_EXPORT
instance, the raster tile sets included in the style – use the
`-satelliteStyleURLWithVersion:` method instead. Such details may change
significantly from version to version.
+
+ #### Related example
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/satellite-style/">
+ Satellite styles</a> example to learn how to initialize a map with the Mapbox
+ Satellite style.
*/
@property (class, nonatomic, readonly) NSURL *satelliteStyleURL;
@@ -208,6 +218,11 @@ MGL_EXPORT
instance, the minimum zoom level that includes roads – use the
`-satelliteStreetsStyleURLWithVersion:` method instead. Such details may
change significantly from version to version.
+
+ #### Related example
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/satellite-style/">
+ Satellite styles</a> example to learn how to initialize a map with the Mapbox
+ Satellite Streets style.
*/
@property (class, nonatomic, readonly) NSURL *satelliteStreetsStyleURL;
@@ -381,6 +396,11 @@ MGL_EXPORT
@param layer The layer to insert.
@param sibling An existing layer in the style.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/shape-collection/">
+ Add multiple shapes from a single shape source</a> example to learn how to
+ add a layer to your map below an existing layer.
*/
- (void)insertLayer:(MGLStyleLayer *)layer belowLayer:(MGLStyleLayer *)sibling;
@@ -401,6 +421,11 @@ MGL_EXPORT
@param layer The layer to insert.
@param sibling An existing layer in the style.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/image-source/">
+ Add an image</a> example to learn how to add a layer to your map above an
+ existing layer.
*/
- (void)insertLayer:(MGLStyleLayer *)layer aboveLayer:(MGLStyleLayer *)sibling;
@@ -459,6 +484,12 @@ MGL_EXPORT
@param image The image for the name.
@param name The name of the image to set to the style.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/clustering-with-images/">
+ Use images to cluster point data</a> and <a href="https://www.mapbox.com/ios-sdk/maps/examples/clustering/">
+ Cluster point data</a> examples to learn how to add images to your map using
+ an `MGLStyle` object.
*/
- (void)setImage:(MGLImage *)image forName:(NSString *)name;
diff --git a/platform/darwin/src/MGLStyleLayer.h b/platform/darwin/src/MGLStyleLayer.h
index 60634946cb..878d7cdbba 100644
--- a/platform/darwin/src/MGLStyleLayer.h
+++ b/platform/darwin/src/MGLStyleLayer.h
@@ -43,6 +43,11 @@ MGL_EXPORT
/**
Whether this layer is displayed. A value of `NO` hides the layer.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/runtime-toggle-layer/">
+ Show and hide a layer</a> example to learn how to toggle an `MGLStyleLayer`
+ object's visibility.
*/
@property (nonatomic, assign, getter=isVisible) BOOL visible;
diff --git a/platform/darwin/src/MGLStyleLayer.h.ejs b/platform/darwin/src/MGLStyleLayer.h.ejs
index 05f450a4f8..9435e0d2ff 100644
--- a/platform/darwin/src/MGLStyleLayer.h.ejs
+++ b/platform/darwin/src/MGLStyleLayer.h.ejs
@@ -1,6 +1,7 @@
<%
const doc = locals.doc;
const type = locals.type;
+ const examples = locals.examples;
const layoutProperties = locals.layoutProperties;
const paintProperties = locals.paintProperties;
const enumProperties = locals.enumProperties;
@@ -68,6 +69,11 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(property.name) %>) {
otherwise, find it using the `MGLStyle.layers` property. You can also create a
new <%- type %> style layer and add it to the style using a method such as
`-[MGLStyle addLayer:]`.
+<% if (examples) { -%>
+
+ #### Related examples
+<%- examples.wrap(80, 1) %>
+<% } -%>
### Example
@@ -118,6 +124,11 @@ which it is added.
<% for (const property of layoutProperties) { -%>
/**
<%- propertyDoc(property.name, property, type, 'layout').wrap(80, 1) %>
+<% if (property.examples) { -%>
+
+ #### Related examples
+<%- propertyExample(property).wrap(80, 1) %>
+<% } -%>
*/
@property (nonatomic<% if (!property.required) { %>, null_resettable<% } if (property.getter) { %>, getter=<%- objCGetter(property) -%><% } %>) NSExpression *<%- camelizeWithLeadingLowercase(property.name) %>;
@@ -133,6 +144,11 @@ which it is added.
<% for (const property of paintProperties) { -%>
/**
<%- propertyDoc(property.name, property, type, 'paint').wrap(80, 1) %>
+<% if (property.examples) { -%>
+
+ #### Related examples
+<%- propertyExample(property).wrap(80, 1) %>
+<% } -%>
*/
@property (nonatomic<% if (!property.required) { %>, null_resettable<% } if (property.getter) { %>, getter=<%- objCGetter(property) -%><% } %>) NSExpression *<%- camelizeWithLeadingLowercase(property.name) %>;
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h
index 363f9efee7..a99e6c23fe 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.h
+++ b/platform/darwin/src/MGLSymbolStyleLayer.h
@@ -356,6 +356,14 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslationAnchor) {
new symbol style layer and add it to the style using a method such as
`-[MGLStyle addLayer:]`.
+ #### Related examples
+ See the <a
+ href="https://www.mapbox.com/ios-sdk/maps/examples/runtime-multiple-annotations/">Dynamically
+ style interactive points</a> and <a
+ href="https://www.mapbox.com/ios-sdk/maps/examples/clustering-with-images/">Use
+ images to cluster point data</a> examples learn how to style data on your map
+ using this layer.
+
### Example
```swift
@@ -509,6 +517,12 @@ MGL_EXPORT
* Variable assignments and references to assigned variables
* Interpolation and step functions applied to the `$zoomLevel` variable and/or
feature attributes
+
+ #### Related examples
+ See the <a
+ href="https://www.mapbox.com/ios-sdk/maps/examples/clustering-with-images/">Use
+ images to cluster point data</a> example to learn how to dynamically set your
+ icons with an expression.
*/
@property (nonatomic, null_resettable) NSExpression *iconImageName;
@@ -1073,6 +1087,14 @@ MGL_EXPORT
* Variable assignments and references to assigned variables
* Interpolation and step functions applied to the `$zoomLevel` variable and/or
feature attributes
+
+ #### Related examples
+ See the <a
+ href="https://www.mapbox.com/ios-sdk/maps/examples/clustering/">Cluster point
+ data</a> and <a
+ href="https://www.mapbox.com/ios-sdk/maps/examples/clustering-with-images/">Use
+ images to cluster point data</a> to learn how to use an expression to set this
+ attribute to the number of markers within a cluster.
*/
@property (nonatomic, null_resettable) NSExpression *text;
diff --git a/platform/darwin/src/MGLTilePyramidOfflineRegion.h b/platform/darwin/src/MGLTilePyramidOfflineRegion.h
index 4fbb68dbc6..7d1f2f511b 100644
--- a/platform/darwin/src/MGLTilePyramidOfflineRegion.h
+++ b/platform/darwin/src/MGLTilePyramidOfflineRegion.h
@@ -12,6 +12,11 @@ NS_ASSUME_NONNULL_BEGIN
To minimize the resources required by an irregularly shaped offline region,
use the MGLShapeOfflineRegion class instead.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/offline-pack/">
+ Download an offline map</a> example to learn how to define an offline region
+ to be downloaded to a user's device.
*/
MGL_EXPORT
@interface MGLTilePyramidOfflineRegion : NSObject <MGLOfflineRegion, NSSecureCoding, NSCopying>
diff --git a/platform/darwin/src/MGLVectorTileSource.h b/platform/darwin/src/MGLVectorTileSource.h
index 70d2f6e8ec..56fee440c8 100644
--- a/platform/darwin/src/MGLVectorTileSource.h
+++ b/platform/darwin/src/MGLVectorTileSource.h
@@ -53,6 +53,11 @@ NS_ASSUME_NONNULL_BEGIN
])
mapView.style?.addSource(source)
```
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/dds-circle-layer/">
+ Data-driven circles</a> example to learn how to add data to your map using
+ an `MGLVectorTileSource` object.
*/
MGL_EXPORT
@interface MGLVectorTileSource : MGLTileSource
diff --git a/platform/darwin/src/NSExpression+MGLAdditions.h b/platform/darwin/src/NSExpression+MGLAdditions.h
index 9ee7361448..a242ecff42 100644
--- a/platform/darwin/src/NSExpression+MGLAdditions.h
+++ b/platform/darwin/src/NSExpression+MGLAdditions.h
@@ -112,6 +112,13 @@ FOUNDATION_EXTERN MGL_EXPORT const MGLExpressionInterpolationMode MGLExpressionI
@param steppingExpression The stepping expression.
@param minimumExpression The expression which could be a constant or function expression.
@param stops The stops must be an `NSDictionary` constant `NSExpression`.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/dds-circle-layer/">
+ Data-driven circles</a>, <a href="https://www.mapbox.com/ios-sdk/maps/examples/clustering/">
+ Cluster point data</a>, and <a href="https://www.mapbox.com/ios-sdk/maps/examples/clustering-with-images/">
+ Use images to cluster point data</a> examples to learn how to use this
+ expression to style a map layer based on an attribute value.
*/
+ (instancetype)mgl_expressionForSteppingExpression:(nonnull NSExpression*)steppingExpression fromExpression:(nonnull NSExpression *)minimumExpression stops:(nonnull NSExpression*)stops NS_SWIFT_NAME(init(forMGLStepping:from:stops:));
@@ -125,6 +132,11 @@ FOUNDATION_EXTERN MGL_EXPORT const MGLExpressionInterpolationMode MGLExpressionI
`MGLExpressionInterpolationModeCubicBezier`.
@param parameters The parameters expression.
@param stops The stops expression.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/heatmap-example/">
+ Create a heatmap layer</a> example to learn how to style an `MGLHeatmapStyleLayer`
+ based on zoom level and point density with this expression.
*/
+ (instancetype)mgl_expressionForInterpolatingExpression:(nonnull NSExpression*)inputExpression withCurveType:(nonnull MGLExpressionInterpolationMode)curveType parameters:(nullable NSExpression *)parameters stops:(nonnull NSExpression*)stops NS_SWIFT_NAME(init(forMGLInterpolating:curveType:parameters:stops:));