Download map area by defining its bounding box - Swift SDK

The MapTiler SDK for iOS provides a powerful Offline Pack API that allows you to download a rectangular area by defining its bounding box for use without an active internet connection.

Before you begin, ensure you have followed the iOS Getting Started with Offline Pack API to set up your project and obtain your API key.

Basic Offline Pack (Bounding Box)


import MapTilerSDK

// Define the bounding box
let bounds = MTBoundingBox(
    minLon: 8.5170, 
    minLat: 47.3500, 
    maxLon: 8.5670, 
    maxLat: 47.4000
)

// Create the region definition
let definition = MTOfflineRegionDefinition(
    geometry: .boundingBox(bounds),
    minZoom: 1,
    maxZoom: 12,
    referenceStyle: .streets
)

// Create and download the pack
Task {
    do {
        let pack = try await MTOfflinePack.createPack(region: definition)
        await pack.download()
        print("Download started for pack: \(pack.id)")
    } catch {
        print("Failed to create pack: \(error)")
    }
}

Learn more

For more information browse our API Reference

Check out our SDK Swift Examples.

Was this helpful?
Mobile SDK
iOS
Download map area by defining its bounding box - Swift SDK
Offline area by bounding box