MGLStyleFunction


@interface MGLStyleFunction <T> : MGLStyleValue<T>

An MGLStyleFunction is a is an abstract superclass for functions that are defined by an MGLCameraStyleFunction, MGLSourceStyleFunction, or MGLCompositeStyleFunction object.

Create instances of MGLCameraStyleFunction, MGLSourceStyleFunction, and MGLCompositeStyleFunction in order to use MGLStyleFunction‘s methods. Do not create instances of MGLStyleFunction directly, and do not create your own subclasses of this class.

The MGLStyleFunction class takes a generic parameter T that indicates the Foundation class being wrapped by this class.

  • Creates and returns an MGLCameraStyleFunction object representing a camera function with a linear interpolation curve.

    Note

    Do not create function instances using this method unless it is required for backwards compatiblity with your application code.

    Declaration

    Objective-C

    + (nonnull instancetype)functionWithStops:
        (nonnull NSDictionary<NSNumber *, MGLStyleValue<T> *> *)stops;

    Swift

    convenience init(stops: [NSNumber : MGLStyleValue<T>])

    Parameters

    stops

    A dictionary associating zoom levels with style values.

    Return Value

    An MGLCameraStyleFunction object with the given stops.

  • Creates and returns an MGLCameraStyleFunction object representing a camera function with an interpolation curve controlled by the provided interpolation base.

    Note

    Do not create function instances using this method unless it is required for backwards compatiblity with your application code.

    Declaration

    Objective-C

    + (nonnull instancetype)
    functionWithInterpolationBase:(CGFloat)interpolationBase
                            stops:(nonnull NSDictionary<NSNumber *,
                                                        MGLStyleValue<T> *> *)stops;

    Parameters

    interpolationBase

    The exponential base of the interpolation curve.

    stops

    A dictionary associating zoom levels with style values.

    Return Value

    An MGLCameraStyleFunction object with the given interpolation base and stops.

  • Returns an MGLStyleFunction object representing a camera function. If the function is set as a style layer property value, it will be interpreted as a camera function with an interpolation curve controlled by the provided interpolation base.

    Note

    Do not create instances of MGLStyleFunction unless it is required for backwards compatiblity with your application code. You should create and use instances of MGLCameraStyleFunction to specify how properties will be visualized at different zoom levels.

    Declaration

    Objective-C

    - (nonnull instancetype)
    initWithInterpolationBase:(CGFloat)interpolationBase
                        stops:
                            (nonnull NSDictionary<NSNumber *, MGLStyleValue<T> *> *)
                                stops;

    Swift

    init(interpolationBase: CGFloat, stops: [NSNumber : MGLStyleValue<T>])

    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.