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.

  • 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. An MGLStyleFunction 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<T>]? { get set }
  • 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<T>? { get set }