---
title: "Download map tiles along a specific route - Swift SDK | Mobile sdk | Mobile sdk ios | Ios"
description: "Offline API allows you to download map tiles along a specific route."
---

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

# Download map tiles along a specific route - Swift SDK

The MapTiler SDK for iOS provides a powerful Offline Pack API that allows you to download map tiles along a specific route defined by a GeoJSON LineString for use without an active internet connection.

Before you begin, ensure you have followed the [iOS Getting Started with Offline Pack API](https://docs.maptiler.com/mobile-sdk/ios/examples/offline-get-started/) to set up your project and obtain your API key.

## Offline Pack for a Route (GeoJSON LineString)

```swift
import MapTilerSDK

// Your GeoJSON LineString
let routeGeoJSON = """
{
    "type": "LineString",
    "coordinates": [
        [8.5417, 47.3769],
        [8.5427, 47.3779],
        [8.5437, 47.3789]
    ]
}
"""

Task {
    do {
        // Extract coordinates from GeoJSON
        let coordinates = try MTGeoJSONParser.extractCoordinates(from: routeGeoJSON)
        
        // Create the route definition with 1000m padding
        let routeDefinition = MTOfflineRegionDefinition(
            geometry: .route(coordinates),
            minZoom: 1,
            maxZoom: 12,
            referenceStyle: .streets,
            padding: 1000
        )
        
        // Create and download the pack
        let pack = try await MTOfflinePack.createPack(region: routeDefinition)
        await pack.download()
        print("Route download started")
    } catch {
        print("Error: \(error)")
    }
}
```

## Learn more

For more information browse our [API Reference](https://docs.maptiler.com/mobile-sdk/ios/api/)

Check out our [SDK Swift Examples](https://docs.maptiler.com/mobile-sdk/ios/examples/).
