@@ -17,12 +17,17 @@ class SourcesAndLayersMapViewController: UIViewController {
1717
1818 override func viewDidLoad( ) {
1919 super. viewDidLoad ( )
20-
20+ Task { await MTConfig . shared . setAPIKey ( " YOUR_API_KEY " ) }
2121 initializeMapView ( )
2222 }
2323
2424 private func initializeMapView( ) {
25- let options = MTMapOptions ( center: Constants . unterageriCoordinates, zoom: Constants . defaultZoomLevel, bearing: 1.0 , pitch: 20.0 )
25+ let options = MTMapOptions (
26+ center: Constants . unterageriCoordinates,
27+ zoom: Constants . defaultZoomLevel,
28+ bearing: 1.0 ,
29+ pitch: 20.0
30+ )
2631 mapView = MTMapView ( frame: view. frame, options: options, referenceStyle: . basic)
2732 mapView. delegate = self
2833
@@ -34,11 +39,17 @@ class SourcesAndLayersMapViewController: UIViewController {
3439 return
3540 }
3641
37- if let contoursTilesURL = URL ( string: " https://api.maptiler.com/tiles/contours-v2/{z}/{x}/{y}.pbf?key=YOUR_API_KEY " ) {
42+ if let contoursTilesURL = URL (
43+ string: " https://api.maptiler.com/tiles/contours-v2/{z}/{x}/{y}.pbf?key=YOUR_API_KEY "
44+ ) {
3845 let contoursDataSource = MTVectorTileSource ( identifier: " contoursSource " , tiles: [ contoursTilesURL] )
3946 style. addSource ( contoursDataSource)
4047
41- let contoursLayer = MTLineLayer ( identifier: " contoursLayer " , sourceIdentifier: contoursDataSource. identifier, sourceLayer: " contour_ft " )
48+ let contoursLayer = MTLineLayer (
49+ identifier: " contoursLayer " ,
50+ sourceIdentifier: contoursDataSource. identifier,
51+ sourceLayer: " contour_ft "
52+ )
4253 contoursLayer. color = . brown
4354 contoursLayer. width = 2.0
4455
0 commit comments