I am having problems so that the Google map can center itself and add a marker when it is connected to the subview as an IBOutlet. I tried to get it to work, it feels like 20 different ways, but I'm stuck, so I would appreciate any help or guidance.
Setting up the code is pretty simple:
@IBOutlet weak var googleMapView: GMSMapView!
override func viewDidLoad() {
super.viewDidLoad()
let camera = GMSCameraPosition.cameraWithLatitude(-33.86, longitude: 151.20, zoom: 6)
let mapView = GMSMapView.mapWithFrame(CGRectZero, camera: camera)
mapView.myLocationEnabled = true
self.googleMapView = mapView
let marker = GMSMarker()
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20)
marker.title = "Sydney"
marker.snippet = "Australia"
marker.map = mapView
I can make it work if the view is the entire view controller by changing self.googleMapView to self.view, but I cannot figure out how to properly connect it to the googleMapView output. Thank!
, , , mapView, .