summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2017-05-05 11:13:33 -0700
committerMinh Nguyễn <mxn@1ec5.org>2017-05-08 14:41:21 -0700
commitdc7e30dd432eb2badc0fcd2bff859d9b6bfcc7d4 (patch)
tree3df0724b5f314f95449db239def74203d366cff9 /platform
parentbaaae99a03202641ae5b8024e57b691fe61a6688 (diff)
downloadqtlocation-mapboxgl-dc7e30dd432eb2badc0fcd2bff859d9b6bfcc7d4.tar.gz
[ios, macos] Fixed syntax error in DDS guide
Diffstat (limited to 'platform')
-rw-r--r--platform/darwin/docs/guides/Using Style Functions at Runtime.md.ejs15
-rw-r--r--platform/ios/docs/guides/Using Style Functions at Runtime.md2
-rw-r--r--platform/macos/docs/guides/Using Style Functions at Runtime.md2
3 files changed, 9 insertions, 10 deletions
diff --git a/platform/darwin/docs/guides/Using Style Functions at Runtime.md.ejs b/platform/darwin/docs/guides/Using Style Functions at Runtime.md.ejs
index bd477042c7..7745ab07a1 100644
--- a/platform/darwin/docs/guides/Using Style Functions at Runtime.md.ejs
+++ b/platform/darwin/docs/guides/Using Style Functions at Runtime.md.ejs
@@ -54,9 +54,9 @@ The effect a key has on the style value is determined by the interpolation mode.
The stops dictionary below, for example, shows colors that continuously shift from yellow to orange to red to blue to white based on the attribute value.
-``` swift
-let url = URL(string: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.geojson")
-let symbolSource = MGLSource(identifier: "source")
+```swift
+let url = URL(string: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.geojson")!
+let symbolSource = MGLSource(identifier: "source")!
let symbolLayer = MGLSymbolStyleLayer(identifier: "place-city-sm", source: symbolSource)
let source = MGLShapeSource(identifier: "earthquakes", url: url, options: nil)
@@ -91,7 +91,7 @@ Here’s a visualization from Mapbox Studio (see [Working with Mapbox Studio](wo
The example below increases a layer’s `circleRadius` exponentially based on a map’s zoom level. The `MGLStyleFunctionOptionInterpolationBase` is `1.5`.
```swift
-let stops = [12: MGLStyleValue(rawValue: 0.5),
+let stops = [12: MGLStyleValue<NSNumber>(rawValue: 0.5),
14: MGLStyleValue(rawValue: 2),
18: MGLStyleValue(rawValue: 18)]
@@ -106,7 +106,7 @@ layer.circleRadius = MGLStyleValue(interpolationMode: .exponential,
When we use the stops dictionary given above with an interval interpolation mode, we create ranges where earthquakes with a magnitude of 0 to just less than 2.5 would be yellow, 2.5 to just less than 5 would be orange, and so on.
-``` swift
+```swift
let stops = [0: MGLStyleValue<<%- cocoaPrefix %>Color>(rawValue: .yellow),
2.5: MGLStyleValue(rawValue: .orange),
5: MGLStyleValue(rawValue: .red),
@@ -127,7 +127,7 @@ At each stop, `MGLInterpolationModeCategorical` produces an output value equal t
There are three main types of events in the dataset: earthquakes, explosions, and quarry blasts. In this case, the color of the circle layer will be determined by the type of event, with a default value of blue to catch any events that do not fall into any of those categories.
-``` swift
+```swift
let categoricalStops = ["earthquake": MGLStyleValue<<%- cocoaPrefix %>Color>(rawValue: .orange),
"explosion": MGLStyleValue(rawValue: .red),
"quarry blast": MGLStyleValue(rawValue: .yellow)]
@@ -145,12 +145,11 @@ layer.circleColor = MGLStyleValue(interpolationMode: .categorical,
`MGLInterpolationModeIdentity` uses the attribute’s value as the style value. For example, you can set the `circleRadius` to the earthquake’s magnitude. Since the attribute value itself will be used as the style value, `sourceStops` should be set to `nil`.
-``` swift
+```swift
layer.circleRadius = MGLStyleValue(interpolationMode: .identity,
sourceStops: nil,
attributeName: "mag",
options: [.defaultValue: MGLStyleValue<NSNumber>(rawValue: 0)])
-
```
![identity mode](img/data-driven-styling/identity.png)
diff --git a/platform/ios/docs/guides/Using Style Functions at Runtime.md b/platform/ios/docs/guides/Using Style Functions at Runtime.md
index 13c4cc0bbc..c4f36ca51d 100644
--- a/platform/ios/docs/guides/Using Style Functions at Runtime.md
+++ b/platform/ios/docs/guides/Using Style Functions at Runtime.md
@@ -49,7 +49,7 @@ The effect a key has on the style value is determined by the interpolation mode.
The stops dictionary below, for example, shows colors that continuously shift from yellow to orange to red to blue to white based on the attribute value.
``` swift
-let url = URL(string: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.geojson")
+let url = URL(string: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.geojson")!
let symbolSource = MGLSource(identifier: "source")
let symbolLayer = MGLSymbolStyleLayer(identifier: "place-city-sm", source: symbolSource)
diff --git a/platform/macos/docs/guides/Using Style Functions at Runtime.md b/platform/macos/docs/guides/Using Style Functions at Runtime.md
index b3098dfe04..c03a35006a 100644
--- a/platform/macos/docs/guides/Using Style Functions at Runtime.md
+++ b/platform/macos/docs/guides/Using Style Functions at Runtime.md
@@ -49,7 +49,7 @@ The effect a key has on the style value is determined by the interpolation mode.
The stops dictionary below, for example, shows colors that continuously shift from yellow to orange to red to blue to white based on the attribute value.
``` swift
-let url = URL(string: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.geojson")
+let url = URL(string: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.geojson")!
let symbolSource = MGLSource(identifier: "source")
let symbolLayer = MGLSymbolStyleLayer(identifier: "place-city-sm", source: symbolSource)