---
title: "MTFitBoundsOptions | Mobile sdk | Mobile sdk ios | Ios"
description: "Options that configure how the map fits to a set of bounds."
---

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

# MTFitBoundsOptions

```
public struct MTFitBoundsOptions : Sendable, Codable
```

Options that configure how the map fits to a set of bounds.

-   `[padding](#/s:11MapTilerSDK18MTFitBoundsOptionsV7paddingAA0dE7PaddingOSgvp)`
    
    Padding to apply on each side of the viewport when fitting the bounds.
    
    #### Declaration
    
    Swift
    
    ```
    public var padding: MTFitBoundsPadding?
    ```
    
-   `[maxZoom](#/s:11MapTilerSDK18MTFitBoundsOptionsV7maxZoomSdSgvp)`
    
    The maximum zoom level that the fit operation can produce.
    
    #### Declaration
    
    Swift
    
    ```
    public var maxZoom: Double?
    ```
    
-   `[linear](#/s:11MapTilerSDK18MTFitBoundsOptionsV6linearSbSgvp)`
    
    Enables linear interpolation instead of the default easing.
    
    #### Declaration
    
    Swift
    
    ```
    public var linear: Bool?
    ```
    
-   `[bearing](#/s:11MapTilerSDK18MTFitBoundsOptionsV7bearingSdSgvp)`
    
    Final bearing for the camera after the fit completes.
    
    #### Declaration
    
    Swift
    
    ```
    public var bearing: Double?
    ```
    
-   `[pitch](#/s:11MapTilerSDK18MTFitBoundsOptionsV5pitchSdSgvp)`
    
    Final pitch for the camera after the fit completes.
    
    #### Declaration
    
    Swift
    
    ```
    public var pitch: Double?
    ```
    
-   `[animationOptions](#/s:11MapTilerSDK18MTFitBoundsOptionsV09animationF0AA011MTAnimationF0VSgvp)`
    
    Additional animation configuration.
    
    #### Declaration
    
    Swift
    
    ```
    public var animationOptions: MTAnimationOptions?
    ```
    
-   `[init(padding:maxZoom:linear:bearing:pitch:animationOptions:)](#/s:11MapTilerSDK18MTFitBoundsOptionsV7padding7maxZoom6linear7bearing5pitch09animationF0AcA0dE7PaddingOSg_SdSgSbSgA2mA011MTAnimationF0VSgtcfc)`
    
    Creates a new set of fit bounds options.
    
    #### Declaration
    
    Swift
    
    ```
    public init(
        padding: MTFitBoundsPadding? = nil,
        maxZoom: Double? = nil,
        linear: Bool? = nil,
        bearing: Double? = nil,
        pitch: Double? = nil,
        animationOptions: MTAnimationOptions? = nil
    )
    ```
    
    #### Parameters
    
    <table class="graybox"><tbody><tr><td><code><em>padding</em></code></td><td><div><p>Padding to apply around the fitted bounds.</p></div></td></tr><tr><td><code><em>maxZoom</em></code></td><td><div><p>Upper zoom limit for the resulting camera.</p></div></td></tr><tr><td><code><em>linear</em></code></td><td><div><p>Boolean indicating whether to animate linearly.</p></div></td></tr><tr><td><code><em>bearing</em></code></td><td><div><p>Target bearing after the fit completes.</p></div></td></tr><tr><td><code><em>pitch</em></code></td><td><div><p>Target pitch after the fit completes.</p></div></td></tr><tr><td><code><em>animationOptions</em></code></td><td><div><p>Extra animation parameters.</p></div></td></tr></tbody></table>
    
-   `[init(from:)](#/s:Se4fromxs7Decoder_p_tKcfc)`
    
    #### Declaration
    
    Swift
    
    ```
    public init(from decoder: any Decoder) throws
    ```
    
-   `[encode(to:)](#/s:SE6encode2toys7Encoder_p_tKF)`
    
    #### Declaration
    
    Swift
    
    ```
    public func encode(to encoder: Encoder) throws
    ```
