summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Erb <josh.erb@mapbox.com>2018-10-30 18:03:56 -0400
committerJosh Erb <josh.erb@mapbox.com>2018-11-12 14:45:30 -0800
commit271b78c1309dd9391e9fc315e9d9873381f5999d (patch)
tree9c195e582180898f977eb7e4eb6a22a1178f4444
parenta3945bf84004ece5116861266a73a60d67beebbe (diff)
downloadqtlocation-mapboxgl-upstream/je-ios-example-links.tar.gz
[ios][documentation] link API documentation to ios-sdk/examplesupstream/je-ios-example-links
-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
-rw-r--r--platform/ios/src/MGLAnnotationImage.h5
-rw-r--r--platform/ios/src/MGLAnnotationView.h10
-rw-r--r--platform/ios/src/MGLCalloutView.h5
-rw-r--r--platform/ios/src/MGLMapView.h67
-rw-r--r--platform/ios/src/MGLMapViewDelegate.h102
-rw-r--r--platform/ios/src/MGLUserLocation.h3
-rw-r--r--platform/ios/src/MGLUserLocationAnnotationView.h5
36 files changed, 475 insertions, 32 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 62471abb16..0cbf9d70f9 100644
--- a/platform/darwin/src/MGLFeature.h
+++ b/platform/darwin/src/MGLFeature.h
@@ -174,6 +174,11 @@ NS_ASSUME_NONNULL_BEGIN
/**
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>
@@ -186,6 +191,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>
@@ -248,6 +258,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:));
diff --git a/platform/ios/src/MGLAnnotationImage.h b/platform/ios/src/MGLAnnotationImage.h
index 0b5a111841..fd76a9b43a 100644
--- a/platform/ios/src/MGLAnnotationImage.h
+++ b/platform/ios/src/MGLAnnotationImage.h
@@ -9,6 +9,11 @@ NS_ASSUME_NONNULL_BEGIN
annotations visually on a map view. Annotation image objects wrap `UIImage`
objects and may be recycled later and put into a reuse queue that is maintained
by the map view.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/marker-image/">
+ Mark a place on the map with an image</a> example to learn how use an image
+ as a marker using `MGLAnnotationImage`.
*/
MGL_EXPORT
@interface MGLAnnotationImage : NSObject <NSSecureCoding>
diff --git a/platform/ios/src/MGLAnnotationView.h b/platform/ios/src/MGLAnnotationView.h
index 57d97e56c1..61fd22f1c2 100644
--- a/platform/ios/src/MGLAnnotationView.h
+++ b/platform/ios/src/MGLAnnotationView.h
@@ -222,6 +222,11 @@ MGL_EXPORT
if it should display itself as unselected.
@param animated `YES` if the change in selection state is animated; `NO` if the
change is immediate.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/annotation-vie
+ ws/">Annotation views</a> example to learn how to modify an
+ `MGLAnnotationView`'s behavior when it is selected.
*/
- (void)setSelected:(BOOL)selected animated:(BOOL)animated;
@@ -250,6 +255,11 @@ MGL_EXPORT
attempting to stop an operation that has already been initiated; doing so can
lead to undefined behavior. Once begun, the drag operation should always
continue to completion.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/draggable-views
+ /">Draggable annotation views</a> to learn how to enable users to drag
+ `MGLAnnotationView` objects on your map.
*/
@property (nonatomic, assign, getter=isDraggable) BOOL draggable;
diff --git a/platform/ios/src/MGLCalloutView.h b/platform/ios/src/MGLCalloutView.h
index 4f88429fbb..7b2177fdd5 100644
--- a/platform/ios/src/MGLCalloutView.h
+++ b/platform/ios/src/MGLCalloutView.h
@@ -11,6 +11,11 @@ NS_ASSUME_NONNULL_BEGIN
To receive updates from an object that conforms to the `MGLCalloutView` protocol,
use the optional methods available in the `MGLCalloutViewDelegate` protocol.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/custom-callout/">
+ Display custom views as callouts</a> example to learn how to customize an
+ `MGLCalloutView`.
*/
@protocol MGLCalloutView <NSObject>
diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h
index 27394b61ff..0f8de86555 100644
--- a/platform/ios/src/MGLMapView.h
+++ b/platform/ios/src/MGLMapView.h
@@ -51,6 +51,9 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationVerticalAlignment) {
/**
The mode used to track the user location on the map. Used with
`MGLMapView.userTrackingMode`.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/user-tracking-mode/">Switch between user tracking modes</a> example to learn how to toggle modes and how each mode behaves.
*/
typedef NS_ENUM(NSUInteger, MGLUserTrackingMode) {
/** The map does not follow the user location. */
@@ -151,7 +154,10 @@ FOUNDATION_EXTERN MGL_EXPORT MGLExceptionName const MGLResourceNotFoundException
@note You are responsible for getting permission to use the map data and for
ensuring that your use adheres to the relevant terms of use.
-
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/simple-map-view/">
+ Simple map view</a> example to learn how to initialize a basic `MGLMapView`.
*/
MGL_EXPORT IB_DESIGNABLE
@interface MGLMapView : UIView
@@ -177,6 +183,16 @@ MGL_EXPORT IB_DESIGNABLE
(`mapbox://styles/{user}/{style}`), or a path to a local file relative
to the application’s resource path. Specify `nil` for the default style.
@return An initialized map view.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/custom-style/">
+ Apply a style designed in Mapbox Studio</a> example to learn how to
+ initialize an `MGLMapView` with a custom style. See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/raster-styles/">
+ Appy a style designed in Mapbox Studio Classic</a> example to learn how to
+ intialize an `MGLMapView` with a Studio Classic style _or_ a custom style
+ JSON. See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/source-custom-vector/">
+ Use third-party vector tiles</a> example to learn how to initialize an
+ `MGLMapView` with a third-party tile source.
*/
- (instancetype)initWithFrame:(CGRect)frame styleURL:(nullable NSURL *)styleURL;
@@ -230,6 +246,11 @@ MGL_EXPORT IB_DESIGNABLE
If you want to modify the current style without replacing it outright, or if
you want to introspect individual style attributes, use the `style` property.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/switch-styles/">
+ Switch between map styles</a> example to learn how to change the style of
+ a map at runtime.
*/
@property (nonatomic, null_resettable) NSURL *styleURL;
@@ -398,6 +419,11 @@ MGL_EXPORT IB_DESIGNABLE
Changing the value of this property updates the map view with an animated
transition. If you don’t want to animate the change, use the
`-setUserTrackingMode:animated:` method instead.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/user-location-annotation/">
+ Customize the user location annotation</a> to learn how to customize the
+ default user location annotation shown by `MGLUserTrackingMode`.
*/
@property (nonatomic, assign) MGLUserTrackingMode userTrackingMode;
@@ -878,6 +904,11 @@ MGL_EXPORT IB_DESIGNABLE
@param animated Specify `YES` if you want the map view to animate the change to
the new viewpoint or `NO` if you want the map to display the new viewpoint
immediately.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/camera-animation/">
+ Camera animation</a> example to learn how to trigger an animation that
+ rotates around a central point.
*/
- (void)setCamera:(MGLMapCamera *)camera animated:(BOOL)animated;
@@ -892,6 +923,11 @@ MGL_EXPORT IB_DESIGNABLE
@param function A timing function used for the animation. Set this parameter to
`nil` for a transition that matches most system animations. If the duration
is `0`, this parameter is ignored.
+
+ #### 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 timed animation that
+ rotates around a central point for a specific duration.
*/
- (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function;
@@ -1115,6 +1151,11 @@ MGL_EXPORT IB_DESIGNABLE
@param point The point to convert.
@param view The view in whose coordinate system the point is expressed.
@return The geographic coordinate at the given point.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/point-conversion/">
+ Point conversion</a> example to learn how to convert a `CGPoint` to a map
+ coordinate.
*/
- (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(nullable UIView *)view;
@@ -1129,6 +1170,11 @@ MGL_EXPORT IB_DESIGNABLE
belong to the same window as the map view.
@return The point (in the appropriate view or window coordinate system)
corresponding to the given geographic coordinate.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/point-conversion/">
+ Point conversion</a> example to learn how to convert a map coordinate to a
+ `CGPoint` object.
*/
- (CGPoint)convertCoordinate:(CLLocationCoordinate2D)coordinate toPointToView:(nullable UIView *)view;
@@ -1200,7 +1246,14 @@ MGL_EXPORT IB_DESIGNABLE
@param annotation The annotation object to add to the receiver. This object
must conform to the `MGLAnnotation` protocol. The map view retains the
- annotation object. */
+ annotation object.
+
+ #### 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/line-geojson/">
+ Add a line annotation from GeoJSON</a> examples to learn how to add an
+ annotation to an `MGLMapView` object.
+ */
- (void)addAnnotation:(id <MGLAnnotation>)annotation;
/**
@@ -1265,6 +1318,11 @@ MGL_EXPORT IB_DESIGNABLE
annotation image object using the `-mapView:imageForAnnotation:` method.
@return An annotation image object with the given identifier, or `nil` if no
such object exists in the reuse queue.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/annotation-view-image/">
+ Add annotation views and images</a> example learn how to most efficiently
+ reuse an `MGLAnnotationImage`.
*/
- (nullable __kindof MGLAnnotationImage *)dequeueReusableAnnotationImageWithIdentifier:(NSString *)identifier;
@@ -1412,6 +1470,11 @@ MGL_EXPORT IB_DESIGNABLE
@param point A point expressed in the map view’s coordinate system.
@return An array of objects conforming to the `MGLFeature` protocol that
represent features in the sources used by the current style.
+
+ #### 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 query an
+ `MGLMapView` object for visible `MGLFeature` objects.
*/
- (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(CGPoint)point NS_SWIFT_NAME(visibleFeatures(at:));
diff --git a/platform/ios/src/MGLMapViewDelegate.h b/platform/ios/src/MGLMapViewDelegate.h
index 77dd2e4ef4..9175669dc9 100644
--- a/platform/ios/src/MGLMapViewDelegate.h
+++ b/platform/ios/src/MGLMapViewDelegate.h
@@ -41,6 +41,11 @@ NS_ASSUME_NONNULL_BEGIN
method returns `YES`, this camera becomes the map view’s camera.
@return A Boolean value indicating whether the map view should stay at
`oldCamera` or change to `newCamera`.
+
+ #### 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 this method
+ and `MGLMapCamera` objects to restrict a users ability to pan your map.
*/
- (BOOL)mapView:(MGLMapView *)mapView shouldChangeFromCamera:(MGLMapCamera *)oldCamera toCamera:(MGLMapCamera *)newCamera;
@@ -72,7 +77,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that the viewpoint depicted by the map view is about to change.
-
+
This method is called whenever the currently displayed map camera will start
changing for any reason.
@@ -103,12 +108,17 @@ NS_ASSUME_NONNULL_BEGIN
an animation, whether due to a user gesture or due to a call to a method such
as `-[MGLMapView setCamera:animated:]`. This method can be called before
`-mapViewDidFinishLoadingMap:` is called.
-
- During the animation, this method may be called many times to report updates to
- the viewpoint. Therefore, your implementation of this method should be as lightweight
+
+ During the animation, this method may be called many times to report updates to
+ the viewpoint. Therefore, your implementation of this method should be as lightweight
as possible to avoid affecting performance.
@param mapView The map view whose viewpoint is changing.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/clustering/">
+ Cluster point data</a> example to learn how to trigger an action whenever
+ the map region changes.
*/
- (void)mapViewRegionIsChanging:(MGLMapView *)mapView;
@@ -137,7 +147,7 @@ NS_ASSUME_NONNULL_BEGIN
changing.
This method is called whenever the currently displayed map camera has finished
- changing, after any calls to `-mapViewRegionIsChanging:` due to animation. Therefore,
+ changing, after any calls to `-mapViewRegionIsChanging:` due to animation. Therefore,
this method can be called before `-mapViewDidFinishLoadingMap:` is called.
@param mapView The map view whose viewpoint has changed.
@@ -243,6 +253,12 @@ NS_ASSUME_NONNULL_BEGIN
@param mapView The map view that has just loaded a style.
@param style The style that was loaded.
+
+ #### 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/shape-collection/">
+ Add multiple shapes from a single shape source</a> examples to learn how to
+ ensure a map's style has loaded before modifying it at runtime.
*/
- (void)mapView:(MGLMapView *)mapView didFinishLoadingStyle:(MGLStyle *)style;
@@ -312,13 +328,13 @@ NS_ASSUME_NONNULL_BEGIN
Returns a screen coordinate at which to position the user location annotation.
This coordinate is relative to the map view’s origin after applying the map view’s
content insets.
-
+
When unimplemented, the user location annotation is aligned within the center of
the map view with respect to the content insets.
-
+
This method will override any values set by `MGLMapView.userLocationVerticalAlignment`
or `-[MGLMapView setUserLocationVerticalAlignment:]`.
-
+
@param mapView The map view that is tracking the user's location.
*/
- (CGPoint)mapViewUserLocationAnchorPoint:(MGLMapView *)mapView;
@@ -343,6 +359,14 @@ NS_ASSUME_NONNULL_BEGIN
displayed.
@return The annotation image object to display for the given annotation or
`nil` if you want to display the default marker image or an annotation view.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/annotation-models/">
+ Annotation models</a>, <a href="https://www.mapbox.com/ios-sdk/maps/examples/annotation-view-image/">
+ Add annotation views and images</a>, and <a href="https://www.mapbox.com/ios-sdk/maps/examples/marker-image/">
+ Mark a place on the map with an image</a> examples to learn to specify which
+ image should be used for `MGLAnnotation` objects that have been added to
+ your map.
*/
- (nullable MGLAnnotationImage *)mapView:(MGLMapView *)mapView imageForAnnotation:(id <MGLAnnotation>)annotation;
@@ -375,6 +399,11 @@ NS_ASSUME_NONNULL_BEGIN
@param mapView The map view rendering the shape annotation.
@param annotation The annotation being rendered.
@return A color to use for the shape outline.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/annotation-models/">
+ Annotation models</a> example to learn how to modify the outline color of an
+ `MGLShape` object that has been added to your map as an annotation.
*/
- (UIColor *)mapView:(MGLMapView *)mapView strokeColorForShapeAnnotation:(MGLShape *)annotation;
@@ -390,6 +419,11 @@ NS_ASSUME_NONNULL_BEGIN
@param mapView The map view rendering the polygon annotation.
@param annotation The annotation being rendered.
@return The polygon’s interior fill color.
+
+ #### 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 modify the color of a an
+ `MGLPolygon` at runtime.
*/
- (UIColor *)mapView:(MGLMapView *)mapView fillColorForPolygonAnnotation:(MGLPolygon *)annotation;
@@ -402,6 +436,11 @@ NS_ASSUME_NONNULL_BEGIN
@param mapView The map view rendering the polygon annotation.
@param annotation The annotation being rendered.
@return A line width for the polyline, measured in points.
+
+ #### 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 modify the
+ line width of an `MGLPolylineFeature` on your map.
*/
- (CGFloat)mapView:(MGLMapView *)mapView lineWidthForPolylineAnnotation:(MGLPolyline *)annotation;
@@ -429,6 +468,12 @@ NS_ASSUME_NONNULL_BEGIN
displayed.
@return The view object to display for the given annotation or `nil` if you
want to display an annotation image instead.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/annotation-view-image/">
+ Add annotation views and images</a> example to learn how to specify what
+ `MGLViewAnnotation` to use for a given `MGLPointAnnotation` object on your
+ map.
*/
- (nullable MGLAnnotationView *)mapView:(MGLMapView *)mapView viewForAnnotation:(id <MGLAnnotation>)annotation;
@@ -449,10 +494,10 @@ NS_ASSUME_NONNULL_BEGIN
/**
Returns a Boolean value indicating whether the shape annotation can be selected.
-
+
If the return value is `YES`, the user can select the annotation by tapping
on it. If the delegate does not implement this method, the default value is `YES`.
-
+
@param mapView The map view that has selected the annotation.
@param annotation The object representing the shape annotation.
@return A Boolean value indicating whether the annotation can be selected.
@@ -470,6 +515,11 @@ NS_ASSUME_NONNULL_BEGIN
@param mapView The map view containing the annotation.
@param annotation The annotation that was selected.
+
+ #### 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 remove an
+ annotation view if it has already been selected.
*/
- (void)mapView:(MGLMapView *)mapView didSelectAnnotation:(id <MGLAnnotation>)annotation;
@@ -544,6 +594,13 @@ NS_ASSUME_NONNULL_BEGIN
@param annotation The object representing the annotation.
@return A Boolean value indicating whether the annotation should show a
callout.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/annotation-view-image/">
+ Add annotation views and images</a>, <a href="https://www.mapbox.com/ios-sdk/maps/examples/custom-callout/">
+ Display custom views as callouts</a>, and <a href="https://www.mapbox.com/ios-sdk/maps/examples/default-callout/">
+ Default callout usage</a> examples to learn how to show callouts for
+ `MGLAnnotation` objects.
*/
- (BOOL)mapView:(MGLMapView *)mapView annotationCanShowCallout:(id <MGLAnnotation>)annotation;
@@ -561,6 +618,11 @@ NS_ASSUME_NONNULL_BEGIN
@param annotation The object representing the annotation.
@return A view conforming to the `MGLCalloutView` protocol, or `nil` to use the
default callout view.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/custom-callout/">
+ Display custom views as callouts</a> example to learn how to customize an
+ `MGLAnnotation` object's `MGLCalloutView`.
*/
- (nullable id <MGLCalloutView>)mapView:(MGLMapView *)mapView calloutViewForAnnotation:(id <MGLAnnotation>)annotation;
@@ -587,6 +649,11 @@ NS_ASSUME_NONNULL_BEGIN
@param mapView The map view presenting the annotation callout.
@param annotation The object representing the annotation with the callout.
@return The accessory view to display.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/default-callout/">
+ Default callout usage</a> example to learn how to modify the view that is
+ displayed on the left side of the standard callout bubble.
*/
- (nullable UIView *)mapView:(MGLMapView *)mapView leftCalloutAccessoryViewForAnnotation:(id <MGLAnnotation>)annotation;
@@ -613,6 +680,11 @@ NS_ASSUME_NONNULL_BEGIN
@param mapView The map view presenting the annotation callout.
@param annotation The object representing the annotation with the callout.
@return The accessory view to display.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/default-callout/">
+ Default callout usage</a> example to learn how to modify the view that is
+ displayed on the right side of the standard callout bubble.
*/
- (nullable UIView *)mapView:(MGLMapView *)mapView rightCalloutAccessoryViewForAnnotation:(id <MGLAnnotation>)annotation;
@@ -638,6 +710,11 @@ NS_ASSUME_NONNULL_BEGIN
@param mapView The map view containing the specified annotation.
@param annotation The annotation whose accessory view was tapped.
@param control The control that was tapped.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/default-callout/">
+ Default callout usage</a> example to learn how to trigger an action when the
+ standard callout bubble's accessory control is tapped.
*/
- (void)mapView:(MGLMapView *)mapView annotation:(id <MGLAnnotation>)annotation calloutAccessoryControlTapped:(UIControl *)control;
@@ -656,6 +733,11 @@ NS_ASSUME_NONNULL_BEGIN
@param mapView The map view containing the specified annotation.
@param annotation The annotation whose callout was tapped.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/custom-callout/">
+ Display custom views as callouts</a> example to learn how to trigger an
+ action when an `MGLAnnotation`s `MGLCalloutView` is tapped.
*/
- (void)mapView:(MGLMapView *)mapView tapOnCalloutForAnnotation:(id <MGLAnnotation>)annotation;
diff --git a/platform/ios/src/MGLUserLocation.h b/platform/ios/src/MGLUserLocation.h
index 4e01cf00c9..de720d9050 100644
--- a/platform/ios/src/MGLUserLocation.h
+++ b/platform/ios/src/MGLUserLocation.h
@@ -11,6 +11,9 @@ NS_ASSUME_NONNULL_BEGIN
the user’s current location. You do not create instances of this class
directly. Instead, you retrieve an existing `MGLUserLocation` object from the
`userLocation` property of the map view displayed in your application.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/user-location-annotation/">Customize the user location annotation</a> example to learn how to overide the default user location annotation.
*/
MGL_EXPORT
@interface MGLUserLocation : NSObject <MGLAnnotation, NSSecureCoding>
diff --git a/platform/ios/src/MGLUserLocationAnnotationView.h b/platform/ios/src/MGLUserLocationAnnotationView.h
index 4d95f39cf3..573fb9f95f 100644
--- a/platform/ios/src/MGLUserLocationAnnotationView.h
+++ b/platform/ios/src/MGLUserLocationAnnotationView.h
@@ -25,6 +25,11 @@ MGL_EXPORT
The value of this property is nil during initialization and while user tracking
is inactive.
+
+ #### Related examples
+ See the <a href="https://www.mapbox.com/ios-sdk/maps/examples/user-location-annotation/">
+ Customize the user location annotation</a> example to learn how to customize
+ the default user location annotation object.
*/
@property (nonatomic, readonly, weak, nullable) MGLUserLocation *userLocation;