summaryrefslogtreecommitdiff
path: root/platform/darwin/docs/guides/For Style Authors.md.ejs
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/docs/guides/For Style Authors.md.ejs')
-rw-r--r--platform/darwin/docs/guides/For Style Authors.md.ejs62
1 files changed, 37 insertions, 25 deletions
diff --git a/platform/darwin/docs/guides/For Style Authors.md.ejs b/platform/darwin/docs/guides/For Style Authors.md.ejs
index 92ce4c1594..93ca7014a3 100644
--- a/platform/darwin/docs/guides/For Style Authors.md.ejs
+++ b/platform/darwin/docs/guides/For Style Authors.md.ejs
@@ -240,30 +240,6 @@ whose names differ from the style specification are listed below:
<% for (const type in renamedProperties) { -%>
<% if (renamedProperties.hasOwnProperty(type)) { -%>
-### <%- camelize(type) %> style functions
-
-The runtime styling API introduces `MGLStyleFunction` to the <%- os %> SDK.
-[Data-driven styling](data-driven-styling.html) expands `MGLStyleFunction`.
-Individual style property documentation includes which subclasses of
-`MGLStyleFunction` are enabled for that property. You can use `MGLStyleValue`
-methods to create a `MGLStyleFunction`.
-
-In style specification | In the SDK | [MGLStyleValue valueWithInterpolationMode:...]
------------------------|-------------------------------|-------------
-`zoom function` | `MGLCameraStyleFunction` | `cameraStops:options:`
-`property function` | `MGLSourceStyleFunction` | `sourceStops:attributeName:options:`
-`zoom-and-property functions`| `MGLCompositeStyleFunction` | `compositeStops:attributeName:options:`
-
-Data-driven styling also introduces interpolation mode, which defines the
-relationship between style values and attributes or zoom levels.
-
-In style specification | In the SDK
------------------------------|-----------
-`exponential` | `MGLInterpolationModeExponential`
-`interval` | `MGLInterpolationModeInterval`
-`categorical` | `MGLInterpolationModeCategorical`
-`identity` | `MGLInterpolationModeIdentity`
-
### <%- camelize(type) %> style layers
In style JSON | In Objective-C | In Swift
@@ -280,10 +256,12 @@ In style JSON | In Objective-C | In Swift
Each property representing a layout or paint attribute is set to an
`MGLStyleValue` object, which is either an `MGLConstantStyleValue` object (for
-constant values) or an `MGLStyleFunction` object (for zoom level functions). The
+constant values) or an `MGLStyleFunction` object (for style functions). The
style value object is a container for the raw value or function parameters that
you want the attribute to be set to.
+### Constant style values
+
In contrast to the JSON type that the style specification defines for each
layout or paint property, the style value object often contains a more specific
Foundation or Cocoa type. General rules for attribute types are listed below.
@@ -326,6 +304,40 @@ translation downward. This is the reverse of how `CGVector` is interpreted on
iOS.
<% } -%>
+### Style functions
+
+A _style function_ allows you to vary the value of a layout or paint attribute
+based on the zoom level, data provided by content sources, or both. For more
+information about style functions that incorporate data from sources, see
+“[Data-Driven Styling](data-driven-styling.html)”.
+
+Each kind of style function is represented by a distinct class, but you
+typically create style functions as you create any other style value, using
+class methods on `MGLStyleValue`:
+
+In style specification | SDK class | SDK factory method
+---------------------------|-----------------------------|-------------------
+zoom function | `MGLCameraStyleFunction` | `+[MGLStyleValue valueWithInterpolationMode:cameraStops:options:]`
+property function | `MGLSourceStyleFunction` | `+[MGLStyleValue valueWithInterpolationMode:sourceStops:attributeName:options:]`
+zoom-and-property function | `MGLCompositeStyleFunction` | `+[MGLStyleValue valueWithInterpolationMode:compositeStops:attributeName:options:]`
+
+The documentation for each individual style layer property indicates the kinds
+of style functions that are enabled for that property.
+
+When you create a style function, you specify an _interpolation mode_ and a
+series of _stops_. Each stop determines the effective value displayed at a
+particular zoom level (for camera functions) or the effective value on features
+with a particular attribute value in the content source (for source functions).
+The interpolation mode tells the SDK how to calculate the effective value
+between any two stops:
+
+In style specification | In the SDK
+-----------------------------|-----------
+`exponential` | `MGLInterpolationModeExponential`
+`interval` | `MGLInterpolationModeInterval`
+`categorical` | `MGLInterpolationModeCategorical`
+`identity` | `MGLInterpolationModeIdentity`
+
## Filtering sources
You can filter a shape or vector source by setting the