All docsMaps SDK for iOSExamplesDisplay a simple map view

Display a simple map view

ViewController
import UIKit
import MapboxMaps
class ViewController: UIViewController {
internal var mapView: MapView!
override public func viewDidLoad() {
super.viewDidLoad()
// Create a map view.
let myResourceOptions = ResourceOptions(accessToken: "your_public_access_token")
let myMapInitOptions = MapInitOptions(resourceOptions: myResourceOptions)
mapView = MapView(frame: view.bounds, mapInitOptions: myMapInitOptions)
// Center the map camera over Stockholm.
mapView.mapboxMap.setCamera(
to: CameraOptions(
center: CLLocationCoordinate2D(
latitude: 59.31,
longitude: 18.06
),
zoom: 9.0
)
)
// Add the map.
self.view.addSubview(mapView)
}
}