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
MGLSourceStyleFunctionobject 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<T>]?, attributeName: String, options: [MGLStyleFunctionOption : Any]? = nil)Parameters
interpolationModeThe mode used to interpolate property values over a range of feature attribute values.
stopsA 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.
-
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
MGLStyleValueobject containing the value to use when the function is given the associated attribute key. AnMGLStyleFunctionobject 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<T>]? { get set } -
An
MGLStyleValueobject 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<T>? { get set }
Install in Dash
MGLSourceStyleFunction Class Reference