let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
mapView.delegate = self
mapView.isMyLocationEnabled = true
view = mapView
search.delegate = self
view.insertSubview(searchbar, aboveSubview: view)
view.bringSubview(toFront: searchbar)// view that UISearchBar is in
view.bringSubview(toFront: search) // actual searchBar
I have tried all kinds of things to make the searchBar
show up. The mapView isn't connected to the CityViewController in the storyboard, just here programmatically for the CityViewController.The storyboard just has a View with the SearchBar located inside of it. The google Maps loads fine in the program but the searchBar NEVER shows up when the program runs but is on the storyboard. If I add the mapView as a subView as well, mapView doesn't show up anymore.
EDIT: I have placed the search bar into a UI View into the main view of the ViewController. If I add constraints, the search bar does not appear. However, it does if I do this. However, I can not type inside of the search bar. I have editted the code to show this.
Try this approach. Drag and drop a search bar on your view controller. set its leading, trailing, and top to 0. Set a constant height of 50.
Then, drag and drop UIView for google maps view. set its class to GMSMapView in Class Inspector. See the screen shot.