MapScale Docs
Integration guides

Add a MapScale map to iOS

Render MapScale tiles in a Swift iOS app with MapLibre Native.

Beginner

Install MapLibre Native

Add MapLibre Native with Swift Package Manager in Xcode.

Install MapLibre Native
https://github.com/maplibre/maplibre-native

Allow network access

MapScale uses HTTPS, so no App Transport Security exception is needed for normal apps.

Create a SwiftUI wrapper

This wrapper creates a native map view and loads the MapScale style.

Create a SwiftUI wrapper
import MapLibre
import SwiftUI

struct MapScaleView: UIViewRepresentable {
	let key = "pk_test_your_key_here"

	func makeUIView(context: Context) -> MLNMapView {
		let url = URL(string: "https://api.mapscale.io/styles/v1/streets?key=\(key)")!
		let map = MLNMapView(frame: .zero, styleURL: url)
		map.setCenter(CLLocationCoordinate2D(latitude: 13.7563, longitude: 100.5018), zoomLevel: 11, animated: false)
		return map
	}

	func updateUIView(_ uiView: MLNMapView, context: Context) {}
}

On this page