summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLShape.h
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2017-01-07 21:48:04 -0800
committerMinh Nguyễn <mxn@1ec5.org>2017-01-09 11:41:05 -0800
commit07496597276b977057839a1cfb3cf15e751c5dab (patch)
tree61cc1897b35c2f41359db9cc7c5ea409c77301f1 /platform/darwin/src/MGLShape.h
parent2b61880b579b8ab0015bf15bf225f0807ed0306d (diff)
downloadqtlocation-mapboxgl-07496597276b977057839a1cfb3cf15e751c5dab.tar.gz
[ios, macos] Added MGLShape from GeoJSON example
Added an example of deserializing an MGLShape from a GeoJSON file.
Diffstat (limited to 'platform/darwin/src/MGLShape.h')
-rw-r--r--platform/darwin/src/MGLShape.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLShape.h b/platform/darwin/src/MGLShape.h
index eae5b3ae21..8dc1b4f1cf 100644
--- a/platform/darwin/src/MGLShape.h
+++ b/platform/darwin/src/MGLShape.h
@@ -41,6 +41,14 @@ NS_ASSUME_NONNULL_BEGIN
collection object, the returned value is an instance of
`MGLShapeCollectionFeature`.
+ ### Example
+
+ ```swift
+ let url = mainBundle.url(forResource: "amsterdam", withExtension: "geojson")!
+ let data = try! Data(contentsOf: url)
+ let feature = try! MGLShape(data: data, encoding: String.Encoding.utf8.rawValue) as! MGLShapeCollectionFeature
+ ```
+
@param data String data containing GeoJSON source code.
@param encoding The encoding used by `data`.
@param outError Upon return, if an error has occurred, a pointer to an