Apply a style designed in Mapbox Studio Classic

Download mapbox-raster-v8.json, open it and replace mapbox.streets with your map ID, and add it to your project or upload the file to your server. For tiles hosted elsewhere, use raster-v8.json.

This technique can load any custom style JSON that conforms to the Mapbox Style Specification.

import Mapbox
class ViewController: UIViewController {
override func viewDidLoad() {
let styleURL = URL(string: "")
// Local paths are also acceptable.
let mapView = MGLMapView(frame: view.bounds, styleURL: styleURL)
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
Was this page helpful?