MGLStyleValue
@interface MGLStyleValue <T> : NSObject
An MGLStyleValue object is a generic container for a style attribute value.
The layout and paint attribute properties of MGLStyleLayer can be set to
MGLStyleValue objects.
The MGLStyleValue class itself represents a class cluster. Under the hood, a
particular MGLStyleValue object may be either an MGLConstantStyleValue to
represent a constant value or one of the concrete subclasses of
MGLStyleFunction to represent a value function. Do not initialize an
MGLStyleValue object directly; instead, use one of the class factory methods
to create an MGLStyleValue object.
The MGLStyleValue class takes a generic parameter T that indicates the
Foundation class being wrapped by this class. Common values for T include:
NSNumber(for Boolean values and floating-point numbers)NSValue(forCGVector,NSEdgeInsets,UIEdgeInsets, and enumerations)NSStringNSColororUIColorNSArray
-
Creates and returns an
MGLConstantStyleValueobject containing a raw value.Declaration
Objective-C
+ (nonnull instancetype)valueWithRawValue:(nonnull T)rawValue;Swift
convenience init(rawValue: T)Parameters
rawValueThe constant value contained by the object.
Return Value
An
MGLConstantStyleValueobject containingrawValue, which is treated as a constant value.
-
Creates and returns an
MGLCameraStyleFunctionobject representing a linear camera function with one or more stops.Declaration
Objective-C
+ (nonnull instancetype)valueWithStops: (nonnull NSDictionary<NSNumber *, MGLStyleValue<T> *> *)stops;Swift
convenience init(stops: [NSNumber : MGLStyleValueParameters
stopsA dictionary associating zoom levels with style values.
Return Value
An
MGLCameraStyleFunctionobject with the given stops. -
Creates and returns an
MGLCameraStyleFunctionobject representing a camera function with an exponential interpolation base and one or more stops.Declaration
Objective-C
+ (nonnull instancetype) valueWithInterpolationBase:(CGFloat)interpolationBase stops:(nonnull NSDictionary<NSNumber *, MGLStyleValue<T> *> *)stops;Swift
convenience init(interpolationBase: CGFloat, stops: [NSNumber : MGLStyleValueParameters
interpolationBaseThe exponential base of the interpolation curve.
stopsA dictionary associating zoom levels with style values.
Return Value
An
MGLCameraStyleFunctionobject with the given interpolation base and stops. -
Creates and returns an
MGLCameraStyleFunctionobject representing a camera function with one or more stops.Declaration
Objective-C
+ (nonnull instancetype) valueWithInterpolationMode:(MGLInterpolationMode)interpolationMode cameraStops: (nonnull NSDictionary<id, MGLStyleValue<T> *> *)cameraStops options:(nullable NSDictionary<MGLStyleFunctionOption, id> *) options;Swift
convenience init(interpolationMode: MGLInterpolationMode, cameraStops: [AnyHashable : MGLStyleValueParameters
interpolationModeThe mode used to interpolate property values between map zoom level changes.
cameraStopsA dictionary associating zoom levels with style values.
optionsA dictionary containing
MGLStyleFunctionOptionvalues that specify how a function is applied.Return Value
An
MGLCameraStyleFunctionobject with the given interpolation mode, camera stops, and options. -
Creates and returns an
MGLSourceStyleFunctionobject representing a source function.Declaration
Objective-C
+ (nonnull instancetype) valueWithInterpolationMode:(MGLInterpolationMode)interpolationMode sourceStops: (nullable NSDictionary<id, MGLStyleValue<T> *> *)sourceStops attributeName:(nonnull NSString *)attributeName options:(nullable NSDictionary<MGLStyleFunctionOption, id> *) options;Swift
convenience init(interpolationMode: MGLInterpolationMode, sourceStops: [AnyHashable : MGLStyleValueParameters
interpolationModeThe mode used to interpolate property values over a range of feature attribute values.
sourceStopsA dictionary associating feature attributes with style values.
attributeNameSpecifies the feature attribute to take as the function input.
optionsA dictionary containing
MGLStyleFunctionOptionvalues that specify how a function is applied.Return Value
An
MGLSourceStyleFunctionobject with the given interpolation mode, source stops, attribute name, and options. -
Creates and returns an
MGLCompositeStyleFunctionobject representing a composite function.Declaration
Objective-C
+ (nonnull instancetype) valueWithInterpolationMode:(MGLInterpolationMode)interpolationMode compositeStops: (nonnull NSDictionary<id, NSDictionary<id, MGLStyleValue<T> *> *> *) compositeStops attributeName:(nonnull NSString *)attributeName options:(nullable NSDictionary<MGLStyleFunctionOption, id> *) options;Swift
convenience init(interpolationMode: MGLInterpolationMode, compositeStops: [AnyHashable : [AnyHashable : MGLStyleValueParameters
interpolationModeThe mode used to interpolate property values over a range of feature attribute values for each outer zoom level.
compositeStopsA dictionary associating feature attributes with style values.
attributeNameSpecifies the feature attribute to take as the function input.
optionsA dictionary containing
MGLStyleFunctionOptionvalues that specify how a function is applied.Return Value
An
MGLCompositeStyleFunctionobject with the given interpolation mode, composite stops, attribute name, and options.
Install in Dash
MGLStyleValue Class Reference