Reputation: 2178
I have loaded the Google Maps SDK for iOS and as per the given example in the google docs shown here. Building my app with this example works fine which is awesome. However, I'd like to show a satellite view instead of the standard view.
I've found you can change the map types as per the documentation here. However, I'm not sure how to do so with the given example.
let mapView = GMSMapView.map(withFrame: self.view.frame, camera: camera)
self.view.addSubview(mapView)
let mapView = GMSMapView.map(withFrame: .zero, camera: camera)
mapView.mapType = .satellite
let mapView = GMSMapView.map(withFrame: view.frame, camera: camera)
view.addSubview(mapView)
My Question
How would I combine both
view.addSubview(mapView)
&mapView.mapType = .satellite
I did find this question here, but couldn't really make heads or tails of it. Probably due to my lack of experience.
Any help would be greatly appreciated.
Upvotes: 1
Views: 494
Reputation: 100503
Use
let mapView = GMSMapView.map(withFrame: .zero, camera: camera)
mapView.mapType = .satellite
view.addSubview(mapView)
Upvotes: 2