title: Google maps change mapType on segmented control click
body: <p>Here is the problem. In my view controller, I have placed a segmented control on the top. </p>
  
  <p>On controller load it displays the map, circle and the marker. Now, when I click the segmented control to change the map type it goes into the code block on select but never updates the Map type. </p>
  
  <p>Please see the code here.</p>
  
  <pre><code>class MapController: UIViewController, CLLocationManagerDelegate , GMSMapViewDelegate {
  
          var locationManager:CLLocationManager!
          let marker = GMSMarker()
          var roundCircle: GMSCircle!
          var mapView = GMSMapView()
          private var didPerformGeocode = false
  
          enum maptype:NSInteger
          {
              case standardmap = 0
              case satellitemap = 1
          }
  
          override func viewDidLoad() {
              super.viewDidLoad()
          }
  
          @IBAction func segmentedControlAction(_ sender: UISegmentedControl)         
  
           {
              switch sender.selectedSegmentIndex {
  
                  case maptype.standardmap.rawValue:
                  mapView.mapType = .normal
  
                  **no change in the map type** 
  
                  case maptype.satellitemap.rawValue:
                  mapView.mapType = .satellite
  
                  **no change in the map type** 
  
                  default:
                  break
              }
          }
  
          override func viewWillAppear(_ animated: Bool) {
              super.viewWillAppear(animated)
              determineMyCurrentLocation()
          }
  
  
          func determineMyCurrentLocation() {
              locationManager = CLLocationManager()
              locationManager.delegate = self
              locationManager.desiredAccuracy = kCLLocationAccuracyBest
              locationManager.requestAlwaysAuthorization()
  
              if CLLocationManager.locationServicesEnabled() {
                  locationManager.startUpdatingLocation()
              }
  
          }
  
  
          func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
              let userLocation:CLLocation = locations[0] as CLLocation
  
              guard !didPerformGeocode else { return }
              didPerformGeocode = true
              locationManager.stopUpdatingLocation()
  
              let camera = GMSCameraPosition.camera(withLatitude: userLocation.coordinate.latitude, longitude: userLocation.coordinate.longitude, zoom: 13.0)
              let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
              mapView.delegate = self
              self.view = mapView
  
              let markerImage = UIImage(named: "mapMarker")!.withRenderingMode(.alwaysTemplate)
              let markerView = UIImageView(image: markerImage)
              markerView.tintColor = UIColor.red
              marker.iconView = markerView
              marker.position = CLLocationCoordinate2D(latitude: userLocation.coordinate.latitude, longitude: userLocation.coordinate.longitude)
              marker.map = mapView
  
  
              roundCircle = GMSCircle(position: camera.target, radius: 1500) //0.96 Miles
              roundCircle.fillColor = UIColor.red.withAlphaComponent(0.3)
              roundCircle.strokeColor = nil
              roundCircle.map = mapView
  
          }
      }
  </code></pre>