Other Protocols
The following protocols are available globally.
MGLCluster
A protocol that feature subclasses (i.e. those already conforming to the MGLFeature
protocol) conform to if they represent clusters.
Currently the only class that conforms to MGLCluster
is MGLPointFeatureCluster
(a subclass of MGLPointFeature
).
To check if a feature is a cluster, check conformity to MGLCluster
, for example:
let shape = try! MGLShape(data: clusterShapeData, encoding: String.Encoding.utf8.rawValue)
guard let pointFeature = shape as? MGLPointFeature else {
throw ExampleError.unexpectedFeatureType
}
// Check for cluster conformance
guard let cluster = pointFeature as? MGLCluster else {
throw ExampleError.featureIsNotACluster
}
// Currently the only supported class that conforms to `MGLCluster` is
// `MGLPointFeatureCluster`
guard cluster is MGLPointFeatureCluster else {
throw ExampleError.unexpectedFeatureType
}
Declaration
Objective-C
@protocol MGLCluster <MGLFeature>
Swift
protocol MGLCluster
MGLComputedShapeSourceDataSource
Data source for MGLComputedShapeSource
. This protocol defines two optional methods for fetching data, one based on tile coordinates, and one based on a bounding box. Classes that implement this protocol must implement one, and only one of the methods. Methods on this protocol will not be called on main thread, they will be called on the caller’s requestQueue
.
Declaration
Objective-C
@protocol MGLComputedShapeSourceDataSource <NSObject>
Swift
protocol MGLComputedShapeSourceDataSource : NSObjectProtocol
MGLMapSnapshotterDelegate
Optional methods about significant events when creating a snapshot using an MGLMapSnapshotter
object.
Declaration
Objective-C
@protocol MGLMapSnapshotterDelegate <NSObject>
Swift
protocol MGLMapSnapshotterDelegate : NSObjectProtocol
MGLOfflineStorageDelegate
The MGLOfflineStorageDelegate
protocol defines methods that a delegate of an MGLOfflineStorage
object can optionally implement to transform various types of URLs before downloading them via the internet.
Declaration
Objective-C
@protocol MGLOfflineStorageDelegate <NSObject>
Swift
protocol MGLOfflineStorageDelegate : NSObjectProtocol
MGLStylable
An object whose contents are represented by an MGLStyle
object that you configure.
Declaration
Objective-C
@protocol MGLStylable <NSObject>
Swift
protocol MGLStylable : NSObjectProtocol
iOS SDK
Examples
SDK JS Reference
- Annotations
- Appendices
- NSExpression(MGLAdditions)
- NSValue(MGLAdditions)
- NSValue(MGLCircleStyleLayerAdditions)
- NSValue(MGLFillExtrusionStyleLayerAdditions)
- NSValue(MGLFillStyleLayerAdditions)
- NSValue(MGLHillshadeStyleLayerAdditions)
- NSValue(MGLLineStyleLayerAdditions)
- NSValue(MGLRasterStyleLayerAdditions)
- NSValue(MGLSymbolStyleLayerAdditions)
- MGLAccountManager
- MGLAnnotationImage
- MGLAnnotationView
- MGLAttributedExpression
- MGLAttributionInfo
- MGLBackgroundStyleLayer
- MGLCircleStyleLayer
- MGLClockDirectionFormatter
- MGLCompassButton
- MGLCompassDirectionFormatter
- MGLComputedShapeSource
- MGLCoordinateFormatter
- MGLDistanceFormatter
- MGLFillExtrusionStyleLayer
- MGLFillStyleLayer
- MGLForegroundStyleLayer
- MGLHeatmapStyleLayer
- MGLHillshadeStyleLayer
- MGLImageSource
- MGLLight
- MGLLineStyleLayer
- MGLLoggingConfiguration
- MGLMapCamera
- MGLMapSnapshot
- MGLMapSnapshotOptions
- MGLMapSnapshotOverlay
- MGLMapSnapshotter
- MGLMapView
- MGLMultiPoint
- MGLMultiPolygon
- MGLMultiPolyline
- MGLNetworkConfiguration
- MGLOfflinePack
- MGLOfflineStorage
- MGLPointAnnotation
- MGLPointCollection
- MGLPolygon
- MGLPolyline
- MGLRasterStyleLayer
- MGLRasterTileSource
- MGLShape
- MGLShapeCollection
- MGLShapeOfflineRegion
- MGLShapeSource
- MGLSource
- MGLStyle
- MGLStyleLayer
- MGLSymbolStyleLayer
- MGLTilePyramidOfflineRegion
- MGLTileSource
- MGLUserLocation
- MGLUserLocationAnnotationView
- MGLUserLocationAnnotationViewStyle
- MGLVectorStyleLayer
- MGLVectorTileSource
- MGLAnnotationVerticalAlignment
- MGLAnnotationViewDragState
- MGLAttributionInfoStyle
- MGLCirclePitchAlignment
- MGLCircleScaleAlignment
- MGLCircleTranslationAnchor
- MGLDEMEncoding
- MGLErrorCode
- MGLFillExtrusionTranslationAnchor
- MGLFillTranslationAnchor
- MGLHillshadeIlluminationAnchor
- MGLIconAnchor
- MGLIconPitchAlignment
- MGLIconRotationAlignment
- MGLIconTextFit
- MGLIconTranslationAnchor
- MGLLightAnchor
- MGLLineCap
- MGLLineJoin
- MGLLineTranslationAnchor
- MGLLoggingLevel
- MGLMapDebugMaskOptions
- MGLOfflinePackState
- MGLOrnamentPosition
- MGLOrnamentVisibility
- MGLRasterResamplingMode
- MGLResourceKind
- MGLSymbolPlacement
- MGLSymbolZOrder
- MGLTextAnchor
- MGLTextJustification
- MGLTextPitchAlignment
- MGLTextRotationAlignment
- MGLTextTransform
- MGLTextTranslationAnchor
- MGLTextWritingMode
- MGLTileCoordinateSystem
- MGLUserTrackingMode
- Formatters
- Geometry
- Location Updates
- Maps
- Offline Maps
- Other Categories
- Other Classes
- Other Constants
- Other Enumerations
- Other Functions
- Other Protocols
- Other Structures
- Other Type Definitions
- Primitive Shapes
- MGLAnnotation
- MGLCalloutView
- MGLCalloutViewDelegate
- MGLCluster
- MGLComputedShapeSourceDataSource
- MGLFeature
- MGLLocationManager
- MGLLocationManagerDelegate
- MGLMapSnapshotterDelegate
- MGLMapViewDelegate
- MGLOfflineRegion
- MGLOfflineStorageDelegate
- MGLOverlay
- MGLStylable
- MGLCoordinateBounds
- MGLCoordinateQuad
- MGLCoordinateSpan
- MGLOfflinePackProgress
- MGLSphericalPosition
- MGLTransition
- Style Content
- Style Layers
- Style Primitives
- Styling the Map
- MGLCoordinateBounds
- MGLCoordinateQuad
- MGLCoordinateSpan
- MGLOfflinePackProgress
- MGLSphericalPosition
- MGLTransition
- User Interaction
- Customizing Fonts
- Information for Style Authors
- Gesture Recognizers
- Info.plist Keys
- Migrating to Expressions
- Predicates and expressions
- Tile URL Templates
- Working with GeoJSON Data