MGLSourceStyleFunction
@interface MGLSourceStyleFunction <T> : MGLStyleFunction<T>
An MGLSourceStyleFunction
is a value function defining a style value that
changes with its properties. The layout and paint attribute properties of an
MGLStyleLayer
object can be set to MGLSourceStyleFunction
objects.
Use source functions to visually differentate types of features within the same
layer or create data visualizations.
The MGLSourceStyleFunction
class takes a generic parameter T
that indicates the
Foundation class being wrapped by this class.
-
Creates and returns an
MGLSourceStyleFunction
object representing a source function.Declaration
Objective-C
+ (nonnull instancetype) functionWithInterpolationMode:(MGLInterpolationMode)interpolationMode stops:(nullable NSDictionary<id, MGLStyleValue<T> *> *) stops attributeName:(nonnull NSString *)attributeName options: (nullable NSDictionary<MGLStyleFunctionOption, id> *) options;
Swift
convenience init(interpolationMode: MGLInterpolationMode, stops: [AnyHashable : MGLStyleValue
Parameters
interpolationMode
The mode used to interpolate property values over a range of feature attribute values.
stops
A dictionary associating feature attributes with style values.
attributeName
Specifies the feature attribute to take as the function input.
options
A dictionary containing
MGLStyleFunctionOption
values that specify how a function is applied.Return Value
An
MGLSourceStyleFunction
object with the given interpolation mode, source stops, attribute name, and options.
-
A string that specifies the feature attribute key whose value be used as the function input.
Declaration
Objective-C
@property (readwrite, copy, nonatomic) NSString *_Nonnull attributeName;
Swift
var attributeName: String { get set }
-
A dictionary associating attribute values with style values.
Each of the function’s stops is represented by one key-value pair in the dictionary. Each key in the dictionary is an object representing a feature attribute key or interpolation stop. Each value in the dictionary is an
MGLStyleValue
object containing the value to use when the function is given the associated attribute key. AnMGLStyleFunction
object may not be used recursively as a stop value.Declaration
Objective-C
@property (readwrite, copy, nonatomic, nullable) NSDictionary<id, MGLStyleValue<T> *> *stops;
Swift
var stops: [AnyHashable : MGLStyleValue
-
An
MGLStyleValue
object containing the default value to use when there is no input to provide to the function.Declaration
Objective-C
@property (assign, readwrite, nonatomic, nullable) MGLStyleValue<T> *defaultValue;
Swift
var defaultValue: MGLStyleValue