All docsMaps SDK for iOS v6ExamplesApply a style designed in Mapbox Studio

Apply a style designed in Mapbox Studio

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.5.0, in the Maps SDK documentation.

Read the Mapbox Studio manual to learn more about creating a custom map style.

import Mapbox
class ViewController: UIViewController {
override func viewDidLoad() {
// Replace the string in the URL below with your custom style URL from Mapbox Studio.
// Read more about style URLs here:
let styleURL = URL(string: "mapbox://styles/mapbox/outdoors-v9")
let mapView = MGLMapView(frame: view.bounds,
styleURL: styleURL)
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
// Set the map’s center coordinate and zoom level.
mapView.setCenter(CLLocationCoordinate2D(latitude: 45.52954,
longitude: -122.72317),
zoomLevel: 14, animated: false)