[ios, macos] Fixed syntax error in DDS guide
This commit is contained in:
@@ -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)])
|
||||
|
||||
```
|
||||
|
||||

|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user