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 MGLStyleConstantValue
to
represent a constant value or an 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)NSString
NSColor
orUIColor
NSArray
-
Creates and returns an
MGLStyleConstantValue
object containing a raw value.Declaration
Objective-C
+ (nonnull instancetype)valueWithRawValue:(nonnull T)rawValue;
Swift
convenience init(rawValue: T)
Parameters
rawValue
The constant value contained by the object.
Return Value
An
MGLStyleConstantValue
object containingrawValue
, which is treated as a constant value. -
Creates and returns an
MGLStyleFunction
object representing a linear zoom level function with any number of stops.Declaration
Objective-C
+ (nonnull instancetype)valueWithStops: (nonnull NSDictionary<NSNumber *, MGLStyleValue<T> *> *)stops;
Swift
convenience init(stops: [NSNumber : MGLStyleValue
Parameters
stops
A dictionary associating zoom levels with style values.
Return Value
An
MGLStyleFunction
object with the given stops. -
Creates and returns an
MGLStyleFunction
object representing a zoom level function with an exponential interpolation base and any number of stops.Declaration
Objective-C
+ (nonnull instancetype) valueWithInterpolationBase:(CGFloat)interpolationBase stops:(nonnull NSDictionary<NSNumber *, MGLStyleValue<T> *> *)stops;
Swift
convenience init(interpolationBase: CGFloat, stops: [NSNumber : MGLStyleValue
Parameters
interpolationBase
The exponential base of the interpolation curve.
stops
A dictionary associating zoom levels with style values.
Return Value
An
MGLStyleFunction
object with the given interpolation base and stops.