Display a globe
Create a map using the globe projection.
import Foundationimport UIKitimport MapboxMaps class GlobeExample: UIViewController, ExampleProtocol {internal var mapView: MapView!private var cancelables = Set<AnyCancelable>() override public func viewDidLoad() {super.viewDidLoad() mapView = MapView(frame: view.bounds, mapInitOptions: .init(styleURI: .satelliteStreets))mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]mapView.mapboxMap.setCamera(to: .init(center: CLLocationCoordinate2D(latitude: 50, longitude: 30), zoom: 0.45))try! self.mapView.mapboxMap.setProjection(StyleProjection(name: .globe)) mapView.mapboxMap.onStyleLoaded.observeNext { [weak self] _ intry! self?.mapView.mapboxMap.setAtmosphere(Atmosphere())self?.finish()}.store(in: &cancelables) view.addSubview(mapView)}}
Was this example helpful?