I installed the Mapbox SDK into my project, but I don't understand how to integrate this code snippet with SwiftUI.
I created a SwiftUI View named MapView, where I import the Mapbox Framework.
I try to use the UIViewRepresentable protocol, as in Apple's tutorial, but without success.
import Mapbox
class MapView: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let styleURL = URL(string: "mapbox://styles/mapbox/outdoors-v9")
let mapView = MGLMapView(frame: view.bounds,
styleURL: styleURL)
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
mapView.setCenter(CLLocationCoordinate2D(latitude: 45.52954,
longitude: -122.72317), …Run Code Online (Sandbox Code Playgroud)