I want to display google maps on a view that\'s then added to self.view, rather than drawing the map directly on self.view. Therefore, I created a
Here's a very simple way to get a Google Maps hooked up to a View in your ViewController in a storyboard (Swift 4.2, Xcode 10).
I'm calling my ViewController MapLocationsViewController.
So, in your storyboard, make sure the class on your ViewController is properly referencing your correct class (MapLocationsViewController for me in this example).
Next, drag a View object onto that ViewController and set that class to GMSMapView.
Hook that View object up to an @IBOutlet in your code (which I named viewForGoogleMap in my example).
Here's a minimalistic example code:
import UIKit
import GoogleMaps
class MapLocationsViewController: UIViewController {
@IBOutlet weak var viewForGoogleMap: GMSMapView!
override func viewDidLoad() {
super.viewDidLoad()
let mapView = GMSMapView(frame: self.view.bounds)
viewForGoogleMap.addSubview(mapView)
}
}
For further info, check out the Google Maps docs.