Simple map view

A newer version of the Maps SDK is available

This page uses v6.4.1 of the Mapbox Maps SDK. A newer version of the SDK is available. Learn about the latest version, v10.1.0, in the Maps SDK documentation.

Other Mapbox template styles can be displayed by referencing any of the defined convenience methods on MGLStyle. Or view the Apply a style designed in Mapbox Studio example to learn how to display custom map style created in Mapbox Studio.

import Mapbox
class ViewController: UIViewController {
override func viewDidLoad() {
let mapView = MGLMapView(frame: view.bounds)
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
// Set the map’s center coordinate and zoom level.
mapView.setCenter(CLLocationCoordinate2D(latitude: 59.31, longitude: 18.06), zoomLevel: 9, animated: false)