---
title: "MTFillLayer | Mobile sdk | Mobile sdk ios | Ios"
description: "The fill style layer that renders one or more filled (and optionally stroked) polygons on a map."
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# 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.

-   `[identifier](#/s:11MapTilerSDK11MTFillLayerC10identifierSSvp)`
    
    Unique layer identifier.
    
    #### Declaration
    
    Swift
    
    ```
    public var identifier: String
    ```
    
-   `[type](#/s:11MapTilerSDK11MTFillLayerC4typeAA11MTLayerTypeOvp)`
    
    Type of the layer.
    
    #### Declaration
    
    Swift
    
    ```
    public private(set) var type: MTLayerType { get }
    ```
    
-   `[sourceIdentifier](#/s:11MapTilerSDK11MTFillLayerC16sourceIdentifierSSvp)`
    
    Identifier of the source to be used for this layer.
    
    #### Declaration
    
    Swift
    
    ```
    public var sourceIdentifier: String
    ```
    
-   `[maxZoom](#/s:11MapTilerSDK11MTFillLayerC7maxZoomSdSgvp)`
    
    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?
    ```
    
-   `[minZoom](#/s:11MapTilerSDK11MTFillLayerC7minZoomSdSgvp)`
    
    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?
    ```
    
-   `[sourceLayer](#/s:11MapTilerSDK11MTFillLayerC06sourceE0SSSgvp)`
    
    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?
    ```
    
-   `[shouldBeAntialised](#/s:11MapTilerSDK11MTFillLayerC18shouldBeAntialisedSbSgvp)`
    
    Boolean indicating whether or not the fill should be antialiased.
    
    Note
    
    Defaults to true.
    
    #### Declaration
    
    Swift
    
    ```
    public var shouldBeAntialised: Bool?
    ```
    
-   `[color](#/s:11MapTilerSDK11MTFillLayerC5colorSo7UIColorCSgvp)`
    
    The color of the filled part of this layer.
    
    Note
    
    Defaults to black.
    
    #### Declaration
    
    Swift
    
    ```
    public var color: UIColor?
    ```
    
-   `[opacity](#/s:11MapTilerSDK11MTFillLayerC7opacitySdSgvp)`
    
    The opacity of the entire fill layer.
    
    Optional number between 0 and 1 inclusive.
    
    Note
    
    Defaults to 1.
    
    #### Declaration
    
    Swift
    
    ```
    public var opacity: Double?
    ```
    
-   `[outlineColor](#/s:11MapTilerSDK11MTFillLayerC12outlineColorSo7UIColorCSgvp)`
    
    The outline color of the fill.
    
    Matches the value of fill-color if unspecified.
    
    #### Declaration
    
    Swift
    
    ```
    public var outlineColor: UIColor?
    ```
    
-   `[translate](#/s:11MapTilerSDK11MTFillLayerC9translateSaySdGSgvp)`
    
    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]?
    ```
    
-   `[translateAnchor](#/s:11MapTilerSDK11MTFillLayerC15translateAnchorAA0d9TranslateG0OSgvp)`
    
    Enum controlling the frame of reference for translate.
    
    #### Declaration
    
    Swift
    
    ```
    public var translateAnchor: MTFillTranslateAnchor?
    ```
    
-   `[sortKey](#/s:11MapTilerSDK11MTFillLayerC7sortKeySdSgvp)`
    
    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?
    ```
    
-   `[visibility](#/s:11MapTilerSDK11MTFillLayerC10visibilityAA17MTLayerVisibilityOSgvp)`
    
    Enum controlling whether this layer is displayed.
    
    #### Declaration
    
    Swift
    
    ```
    public var visibility: MTLayerVisibility?
    ```
    
-   `[initialFilter](#/s:11MapTilerSDK11MTFillLayerC13initialFilterAA15MTPropertyValueOSgvp)`
    
    Optional initial filter to apply after the layer is added to the map.
    
    #### Declaration
    
    Swift
    
    ```
    public var initialFilter: MTPropertyValue?
    ```
    
-   `[init(identifier:sourceIdentifier:maxZoom:minZoom:sourceLayer:)](#/s:11MapTilerSDK11MTFillLayerC10identifier16sourceIdentifier7maxZoom03minJ00gE0ACSS_SSS2dSSSgtcfc)`
    
    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
    )
    ```
    
-   `[init(identifier:sourceIdentifier:)](#/s:11MapTilerSDK11MTFillLayerC10identifier16sourceIdentifierACSS_SStcfc)`
    
    Initializes the layer with the unique identifier and a source identifier.
    
    #### Declaration
    
    Swift
    
    ```
    public init(
        identifier: String,
        sourceIdentifier: String
    )
    ```
    
-   `[init(identifier:sourceIdentifier:maxZoom:minZoom:sourceLayer:shouldBeAntialised:color:opacity:outlineColor:translate:translateAnchor:sortKey:visibility:)](#/s:11MapTilerSDK11MTFillLayerC10identifier16sourceIdentifier7maxZoom03minJ00gE018shouldBeAntialised5color7opacity12outlineColor9translate0S6Anchor7sortKey10visibilityACSS_SSSdSgAQSSSgSbSgSo7UIColorCSgAqVSaySdGSgAA0d9TranslateT0OSgAqA17MTLayerVisibilityOSgtcfc)`
    
    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
    )
    ```
    
-   `[init(from:)](#/s:11MapTilerSDK11MTFillLayerC4fromACs7Decoder_p_tKcfc)`
    
    Initializes the layer from the decoder.
    
    #### Declaration
    
    Swift
    
    ```
    public required init(from decoder: any Decoder) throws
    ```
    
-   `[encode(to:)](#/s:SE6encode2toys7Encoder_p_tKF)`
    
    #### Declaration
    
    Swift
    
    ```
    public func encode(to encoder: Encoder) throws
    ```
    
-   `[addToMap(_:)](#/s:11MapTilerSDK11MTFillLayerC05addToA0yyAA9MTMapViewCF)`
    
    Adds layer to map DSL style.
    
    Prefer `[addLayer(_:)](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTStyle/#/s:11MapTilerSDK7MTStyleC8addLayeryyAA7MTLayer_pYaKF)` on MTMapView instead.
    
    #### Declaration
    
    Swift
    
    ```
    public func addToMap(_ mapView: MTMapView)
    ```
    
-   `[maxZoom(_:)](#/s:11MapTilerSDK11MTFillLayerC7maxZoomyACXDSdF)`
    
    Modifier. Sets the `[maxZoom](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTFillLayer/#/s:11MapTilerSDK11MTFillLayerC7maxZoomSdSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func maxZoom(_ value: Double) -> Self
    ```
    
-   `[minZoom(_:)](#/s:11MapTilerSDK11MTFillLayerC7minZoomyACXDSdF)`
    
    Modifier. Sets the `[minZoom](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTFillLayer/#/s:11MapTilerSDK11MTFillLayerC7minZoomSdSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func minZoom(_ value: Double) -> Self
    ```
    
-   `[sourceLayer(_:)](#/s:11MapTilerSDK11MTFillLayerC06sourceE0yACXDSSF)`
    
    Modifier. Sets the `[sourceLayer](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTFillLayer/#/s:11MapTilerSDK11MTFillLayerC06sourceE0SSSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func sourceLayer(_ value: String) -> Self
    ```
    
-   `[shouldBeAntialised(_:)](#/s:11MapTilerSDK11MTFillLayerC18shouldBeAntialisedyACXDSbF)`
    
    Modifier. Sets the `[shouldBeAntialised](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTFillLayer/#/s:11MapTilerSDK11MTFillLayerC18shouldBeAntialisedSbSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func shouldBeAntialised(_ value: Bool) -> Self
    ```
    
-   `[color(_:)](#/s:11MapTilerSDK11MTFillLayerC5coloryACXDSo7UIColorCF)`
    
    Modifier. Sets the `[color](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTFillLayer/#/s:11MapTilerSDK11MTFillLayerC5colorSo7UIColorCSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func color(_ value: UIColor) -> Self
    ```
    
-   `[opacity(_:)](#/s:11MapTilerSDK11MTFillLayerC7opacityyACXDSdF)`
    
    Modifier. Sets the `[opacity](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTFillLayer/#/s:11MapTilerSDK11MTFillLayerC7opacitySdSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func opacity(_ value: Double) -> Self
    ```
    
-   `[outlineColor(_:)](#/s:11MapTilerSDK11MTFillLayerC12outlineColoryACXDSo7UIColorCF)`
    
    Modifier. Sets the `[outlineColor](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTFillLayer/#/s:11MapTilerSDK11MTFillLayerC12outlineColorSo7UIColorCSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func outlineColor(_ value: UIColor) -> Self
    ```
    
-   `[translate(_:)](#/s:11MapTilerSDK11MTFillLayerC9translateyACXDSaySdGF)`
    
    Modifier. Sets the `[translate](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTFillLayer/#/s:11MapTilerSDK11MTFillLayerC9translateSaySdGSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func translate(_ value: [Double]) -> Self
    ```
    
-   `[translateAnchor(_:)](#/s:11MapTilerSDK11MTFillLayerC15translateAnchoryACXDAA0d9TranslateG0OF)`
    
    Modifier. Sets the `[translateAnchor](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTFillLayer/#/s:11MapTilerSDK11MTFillLayerC15translateAnchorAA0d9TranslateG0OSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func translateAnchor(_ value: MTFillTranslateAnchor) -> Self
    ```
    
-   `[sortKey(_:)](#/s:11MapTilerSDK11MTFillLayerC7sortKeyyACXDSdF)`
    
    Modifier. Sets the `[sortKey](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTFillLayer/#/s:11MapTilerSDK11MTFillLayerC7sortKeySdSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func sortKey(_ value: Double) -> Self
    ```
    
-   `[visibility(_:)](#/s:11MapTilerSDK11MTFillLayerC10visibilityyACXDAA17MTLayerVisibilityOF)`
    
    Modifier. Sets the `[visibility](https://docs.maptiler.com/mobile-sdk/ios/api/Classes/MTFillLayer/#/s:11MapTilerSDK11MTFillLayerC10visibilityAA17MTLayerVisibilityOSgvp)`.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func visibility(_ value: MTLayerVisibility) -> Self
    ```
    
-   `[withFilter(_:)](#/s:11MapTilerSDK11MTFillLayerC10withFilteryACXDAA15MTPropertyValueOF)`
    
    Modifier. Sets the initial filter to apply upon add.
    
    Note
    
    Not to be used outside of DSL.
    
    #### Declaration
    
    Swift
    
    ```
    @discardableResult
    public func withFilter(_ value: MTPropertyValue) -> Self
    ```
    
-   `[==(_:_:)](#/s:SQ2eeoiySbx_xtFZ)`
    
    #### Declaration
    
    Swift
    
    ```
    public static func == (lhs: MTFillLayer, rhs: MTFillLayer) -> Bool
    ```
