[darwin] - re-add swift documentation

This commit is contained in:
Tobrun
2017-07-05 21:15:54 +02:00
parent 9ab04a2965
commit 79d849dc44
6 changed files with 44 additions and 0 deletions

View File

@@ -64,6 +64,16 @@ typedef NS_ENUM(NSUInteger, MGLCircleTranslationAnchor) {
### Example
```swift
let layer = MGLCircleStyleLayer(identifier: "circles", source: population)
layer.sourceLayerIdentifier = "population"
layer.circleColor = MGLStyleValue(rawValue: .green)
layer.circleRadius = MGLStyleValue(interpolationMode: .exponential,
cameraStops: [12: MGLStyleValue(rawValue: 2),
22: MGLStyleValue(rawValue: 180)],
options: [.interpolationBase: 1.75])
layer.circleOpacity = MGLStyleValue(rawValue: 0.7)
layer.predicate = NSPredicate(format: "%K == %@", "marital-status", "married")
mapView.style?.addLayer(layer)
```
*/
MGL_EXPORT

View File

@@ -42,6 +42,12 @@ typedef NS_ENUM(NSUInteger, MGLFillExtrusionTranslationAnchor) {
### Example
```swift
let layer = MGLFillExtrusionStyleLayer(identifier: "buildings", source: buildings)
layer.sourceLayerIdentifier = "building"
layer.fillExtrusionHeight = MGLStyleValue(interpolationMode: .identity, sourceStops: nil, attributeName: "height", options: nil)
layer.fillExtrusionBase = MGLStyleValue(interpolationMode: .identity, sourceStops: nil, attributeName: "min_height", options: nil)
layer.predicate = NSPredicate(format: "extrude == 'true'")
mapView.style?.addLayer(layer)
```
*/
MGL_EXPORT

View File

@@ -42,6 +42,11 @@ typedef NS_ENUM(NSUInteger, MGLFillTranslationAnchor) {
### Example
```swift
let layer = MGLFillStyleLayer(identifier: "parks", source: parks)
layer.sourceLayerIdentifier = "parks"
layer.fillColor = MGLStyleValue(rawValue: .green)
layer.predicate = NSPredicate(format: "type == %@", "national-park")
mapView.style?.addLayer(layer)
```
*/
MGL_EXPORT

View File

@@ -92,6 +92,16 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslationAnchor) {
### Example
```swift
let layer = MGLLineStyleLayer(identifier: "trails-path", source: trails)
layer.sourceLayerIdentifier = "trails"
layer.lineWidth = MGLStyleValue(interpolationMode: .exponential,
cameraStops: [14: MGLStyleValue(rawValue: 2),
18: MGLStyleValue(rawValue: 20)],
options: [.interpolationBase: 1.5])
layer.lineColor = MGLStyleValue(rawValue: .brown)
layer.lineCap = MGLStyleValue(rawValue: NSValue(mglLineCap: .round))
layer.predicate = NSPredicate(format: "%K == %@", "trail-type", "mountain-biking")
mapView.style?.addLayer(layer)
```
*/
MGL_EXPORT

View File

@@ -28,6 +28,9 @@ NS_ASSUME_NONNULL_BEGIN
### Example
```swift
let layer = MGLRasterStyleLayer(identifier: "clouds", source: source)
layer.rasterOpacity = MGLStyleValue(rawValue: 0.5)
mapView.style?.addLayer(layer)
```
*/
MGL_EXPORT

View File

@@ -265,6 +265,16 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslationAnchor) {
### Example
```swift
let layer = MGLSymbolStyleLayer(identifier: "coffeeshops", source: pois)
layer.sourceLayerIdentifier = "pois"
layer.iconImageName = MGLStyleValue(rawValue: "coffee")
layer.iconScale = MGLStyleValue(rawValue: 0.5)
layer.text = MGLStyleValue(rawValue: "{name}")
layer.textTranslation = MGLStyleValue(rawValue: NSValue(cgVector: CGVector(dx: 10, dy: 0)))
layer.textJustification = MGLStyleValue(rawValue: NSValue(mglTextJustification: .left))
layer.textAnchor = MGLStyleValue(rawValue: NSValue(mglTextAnchor: .left))
layer.predicate = NSPredicate(format: "%K == %@", "venue-type", "coffee")
mapView.style?.addLayer(layer)
```
*/
MGL_EXPORT