MTFillLayer

public class MTFillLayer : MTLayer, @unchecked Sendable, Codable
extension MTFillLayer: Equatable

The fill style layer that renders one or more filled (and optionally stroked) polygons on a map.

  • Unique layer identifier.

    Declaration

    Swift

    public var identifier: String
  • Type of the layer.

    Declaration

    Swift

    public private(set) var type: MTLayerType { get }
  • Identifier of the source to be used for this layer.

    Declaration

    Swift

    public var sourceIdentifier: String
  • The maximum zoom level for the layer.

    Optional number between 0 and 24. At zoom levels equal to or greater than the maxzoom, the layer will be hidden.

    Declaration

    Swift

    public var maxZoom: Double?
  • The minimum zoom level for the layer.

    Optional number between 0 and 24. At zoom levels less than the minzoom, the layer will be hidden.

    Declaration

    Swift

    public var minZoom: Double?
  • Layer to use from a vector tile source.

    Required for vector tile sources; prohibited for all other source types, including GeoJSON sources.

    Declaration

    Swift

    public var sourceLayer: String?
  • Boolean indicating whether or not the fill should be antialiased.

    Note

    Defaults to true.

    Declaration

    Swift

    public var shouldBeAntialised: Bool?
  • The color of the filled part of this layer.

    Note

    Defaults to black.

    Declaration

    Swift

    public var color: UIColor?
  • The opacity of the entire fill layer.

    Optional number between 0 and 1 inclusive.

    Note

    Defaults to 1.

    Declaration

    Swift

    public var opacity: Double?
  • The outline color of the fill.

    Matches the value of fill-color if unspecified.

    Declaration

    Swift

    public var outlineColor: UIColor?
  • The geometry’s offset.

    Units in pixels. Values are [x, y] where negatives indicate left and up, respectively.

    Note

    Defaults to [0,0].

    Declaration

    Swift

    public var translate: [Double]?
  • Enum controlling the frame of reference for translate.

    Declaration

    Swift

    public var translateAnchor: MTFillTranslateAnchor?
  • Key for sorting features.

    Features with a higher sort key will appear above features with a lower sort key.

    Declaration

    Swift

    public var sortKey: Double?
  • Enum controlling whether this layer is displayed.

    Declaration

    Swift

    public var visibility: MTLayerVisibility?
  • Initializes the layer with unique identifier, source identifier, max and min zoom levels and source layer, which is required for vector tile sources.

    Declaration

    Swift

    public init(
        identifier: String,
        sourceIdentifier: String,
        maxZoom: Double,
        minZoom: Double,
        sourceLayer: String? = nil
    )
  • Initializes the layer with the unique identifier and a source identifier.

    Declaration

    Swift

    public init(
        identifier: String,
        sourceIdentifier: String
    )
  • Initializes the layer with all options.

    Declaration

    Swift

    public init(
        identifier: String,
        sourceIdentifier: String,
        maxZoom: Double? = nil,
        minZoom: Double? = nil,
        sourceLayer: String? = nil,
        shouldBeAntialised: Bool? = true,
        color: UIColor? = .black,
        opacity: Double? = 1.0,
        outlineColor: UIColor? = nil,
        translate: [Double]? = nil,
        translateAnchor: MTFillTranslateAnchor? = .map,
        sortKey: Double? = nil,
        visibility: MTLayerVisibility? = .visible
    )
  • Initializes the layer from the decoder.

    Declaration

    Swift

    public required init(from decoder: any Decoder) throws
  • Declaration

    Swift

    public func encode(to encoder: Encoder) throws
  • Adds layer to map DSL style.

    Prefer addLayer(_:) on MTMapView instead.

    Declaration

    Swift

    public func addToMap(_ mapView: MTMapView)
  • Modifier. Sets the maxZoom.

    Note

    Not to be used outside of DSL.

    Declaration

    Swift

    @discardableResult
    public func maxZoom(_ value: Double) -> Self
  • Modifier. Sets the minZoom.

    Note

    Not to be used outside of DSL.

    Declaration

    Swift

    @discardableResult
    public func minZoom(_ value: Double) -> Self
  • Modifier. Sets the sourceLayer.

    Note

    Not to be used outside of DSL.

    Declaration

    Swift

    @discardableResult
    public func sourceLayer(_ value: String) -> Self
  • Modifier. Sets the shouldBeAntialised.

    Note

    Not to be used outside of DSL.

    Declaration

    Swift

    @discardableResult
    public func shouldBeAntialised(_ value: Bool) -> Self
  • Modifier. Sets the color.

    Note

    Not to be used outside of DSL.

    Declaration

    Swift

    @discardableResult
    public func color(_ value: UIColor) -> Self
  • Modifier. Sets the opacity.

    Note

    Not to be used outside of DSL.

    Declaration

    Swift

    @discardableResult
    public func opacity(_ value: Double) -> Self
  • Modifier. Sets the outlineColor.

    Note

    Not to be used outside of DSL.

    Declaration

    Swift

    @discardableResult
    public func outlineColor(_ value: UIColor) -> Self
  • Modifier. Sets the translate.

    Note

    Not to be used outside of DSL.

    Declaration

    Swift

    @discardableResult
    public func translate(_ value: [Double]) -> Self
  • Modifier. Sets the translateAnchor.

    Note

    Not to be used outside of DSL.

    Declaration

    Swift

    @discardableResult
    public func translateAnchor(_ value: MTFillTranslateAnchor) -> Self
  • Modifier. Sets the sortKey.

    Note

    Not to be used outside of DSL.

    Declaration

    Swift

    @discardableResult
    public func sortKey(_ value: Double) -> Self
  • Modifier. Sets the visibility.

    Note

    Not to be used outside of DSL.

    Declaration

    Swift

    @discardableResult
    public func visibility(_ value: MTLayerVisibility) -> Self
  • Declaration

    Swift

    public static func == (lhs: MTFillLayer, rhs: MTFillLayer) -> Bool