MapLibre Native iOS
MapLibre Native iOS renders vector maps in native iOS apps. It loads the Maptoolkit community style URL directly, with no API key.
Installation
Add MapLibre Native with Swift Package Manager. In Xcode, go to File → Add Package Dependencies and add:
https://github.com/maplibre/maplibre-gl-native-distributionChoose the latest version. CocoaPods is also supported through the MapLibre pod.
Set the style URL
Create an MLNMapView and set its styleURL to the community style URL.
import MapLibre
class MapViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let styleURL = URL(string: "https://styles.maptoolkit.org/summer.json")
let mapView = MLNMapView(frame: view.bounds, styleURL: styleURL)
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
// Center on Vienna
mapView.setCenter(
CLLocationCoordinate2D(latitude: 48.21, longitude: 16.37),
zoomLevel: 12,
animated: false
)
view.addSubview(mapView)
}
}To change the style at runtime, set mapView.styleURL again:
mapView.styleURL = URL(string: "https://styles.maptoolkit.org/summer.json")Examples
See the Examples gallery for annotations and runtime style switching.
Attribution
Every map must show the Maptoolkit logo (minimum 24pt) and the © Maptoolkit © OSM copyright line, both as tappable links. Keep them visible and unobstructed. See Quick Start - Add attribution.