Basic map
Add a map to your application. Right out of the box, the map displays geographic boundaries, street names, road data, and more. The map can be then be styled, moved, and rotated.
import UIKit
import TrimbleMaps
import TrimbleMapsAccounts
class BasicMapViewController: UIViewController, AccountManagerDelegate {
internal var mapView: TMGLMapView!
override func viewDidLoad() {
super.viewDidLoad()
let account = Account(apiKey: apiKey, region: Region.northAmerica)
AccountManager.default.account = account
AccountManager.default.delegate = self
}
func stateChanged(newStatus: AccountManagerState) {
if newStatus == .loaded {
DispatchQueue.main.async {
// Create a map view
self.mapView = TMGLMapView(frame: self.view.bounds)
// Add the map
self.view.addSubview(self.mapView)
}
}
}
}