Docs · iOS · Swift

Frameworks

iOS · Swift

MapLibre Native for iOS, wrapped for SwiftUI.

Example

OrviaMap.swiftswift
1// Swift Package: https://github.com/maplibre/maplibre-gl-native-distribution2import SwiftUI3import MapLibre45struct OrviaMap: UIViewRepresentable {6  func makeUIView(context: Context) -> MLNMapView {7    let style = URL(string: "https://orviamaps.ir/api/v1/style.json?key=YOUR_API_KEY")8    let map = MLNMapView(frame: .zero, styleURL: style)9    map.setCenter(10      CLLocationCoordinate2D(latitude: 35.689, longitude: 51.389),11      zoomLevel: 11,12      animated: false13    )14    return map15  }1617  func updateUIView(_ map: MLNMapView, context: Context) {}18}

Replace YOUR_API_KEY with a key from your account, or read it from an environment variable as shown.