Lewis
Lewis

Reputation: 2178

How would i display Google Maps SDK iOS Satellite view using googles own example

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.

Google's MapView Example.

let mapView = GMSMapView.map(withFrame: self.view.frame, camera: camera)
self.view.addSubview(mapView)

Google's MapType Example.

let mapView = GMSMapView.map(withFrame: .zero, camera: camera)
mapView.mapType = .satellite

My Current Solution (Working)

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

Answers (1)

Shehata Gamal
Shehata Gamal

Reputation: 100503

Use

let mapView = GMSMapView.map(withFrame: .zero, camera: camera) 
mapView.mapType = .satellite 
view.addSubview(mapView)

Upvotes: 2

Related Questions