summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmkiley <jordan.kiley@mapbox.com>2019-10-10 16:28:23 -0700
committerjmkiley <jordan.kiley@mapbox.com>2019-10-10 16:28:23 -0700
commitf74ca45b9c3853358a1c417e9e15568559966c38 (patch)
tree73c83dbce058cb3f2a17d0211ba200ff7a781093
parentcb9b29aa09d82844f276305a748a411eb85c67cb (diff)
downloadqtlocation-mapboxgl-upstream/jmkiley-cluster-properties.tar.gz
[ios] Update code snippetupstream/jmkiley-cluster-properties
-rw-r--r--platform/darwin/src/MGLShapeSource.h5
-rw-r--r--platform/darwin/test/MGLDocumentationExampleTests.swift7
2 files changed, 4 insertions, 8 deletions
diff --git a/platform/darwin/src/MGLShapeSource.h b/platform/darwin/src/MGLShapeSource.h
index 685a7116a2..675c219300 100644
--- a/platform/darwin/src/MGLShapeSource.h
+++ b/platform/darwin/src/MGLShapeSource.h
@@ -57,10 +57,9 @@ FOUNDATION_EXTERN MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionClus
attribute values are accessed from individual features within a cluster.
```swift
- let key = "sumValue"
- let firstExpression = NSExpression(format: "sum({ $featureAccumulated, %@ })", key)
+ let firstExpression = NSExpression(format: "sum:({$featureAccumulated, sumValue})")
let secondExpression = NSExpression(forKeyPath: "magnitude")
- let clusterPropertiesDictionary = [key : [firstExpression, secondExpression]]
+ let clusterPropertiesDictionary = ["sumValue" : [firstExpression, secondExpression]]
let options : [MGLShapeSourceOption : Any] = [.clustered : true,
.clusterProperties: clusterPropertiesDictionary]
diff --git a/platform/darwin/test/MGLDocumentationExampleTests.swift b/platform/darwin/test/MGLDocumentationExampleTests.swift
index f409de5b4a..7d6bdbed54 100644
--- a/platform/darwin/test/MGLDocumentationExampleTests.swift
+++ b/platform/darwin/test/MGLDocumentationExampleTests.swift
@@ -556,13 +556,10 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate {
}
func testMGLShapeSourceOptionClusterProperties() {
-
-
//#-example-code
- let key = "sumValue"
- let firstExpression = NSExpression(format: "sum({ $featureAccumulated, %@ })", key)
+ let firstExpression = NSExpression(format: "sum:({$featureAccumulated, sumValue})")
let secondExpression = NSExpression(forKeyPath: "magnitude")
- let clusterPropertiesDictionary = [key : [firstExpression, secondExpression]]
+ let clusterPropertiesDictionary = ["sumValue" : [firstExpression, secondExpression]]
let options : [MGLShapeSourceOption : Any] = [.clustered : true,
.clusterProperties: clusterPropertiesDictionary]