summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLShapeOfflineRegion.h
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src/MGLShapeOfflineRegion.h')
-rw-r--r--platform/darwin/src/MGLShapeOfflineRegion.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLShapeOfflineRegion.h b/platform/darwin/src/MGLShapeOfflineRegion.h
index ac54dc137b..f1def03be8 100644
--- a/platform/darwin/src/MGLShapeOfflineRegion.h
+++ b/platform/darwin/src/MGLShapeOfflineRegion.h
@@ -10,6 +10,20 @@ NS_ASSUME_NONNULL_BEGIN
An offline region defined by a style URL, geographic shape, and
range of zoom levels.
+ ### Example
+ ```swift
+ var coordinates = [
+ CLLocationCoordinate2D(latitude: 45.522585, longitude: -122.685699),
+ CLLocationCoordinate2D(latitude: 45.534611, longitude: -122.708873),
+ CLLocationCoordinate2D(latitude: 45.530883, longitude: -122.678833)
+ ]
+
+ let triangle = MGLPolygon(coordinates: &coordinates, count: UInt(coordinates.count))
+ let region = MGLShapeOfflineRegion(styleURL: MGLStyle.lightStyleURL, shape: triangle, fromZoomLevel: 11, toZoomLevel: 14)
+ let context = "Triangle Region".data(using: .utf8)
+ MGLOfflineStorage.shared.addPack(for: region, withContext: context!)
+ ```
+
This class requires fewer resources than MGLTilePyramidOfflineRegion
for irregularly shaped regions.
*/