title: Scale custom marker icon according to zoom level
body: <p>I'm trying to scale a custom marker icon according to the zoom level. My icon should be pretty big while you are zooming very close, but obviously it will be way to big when you zoom far out, so it should automatically scale down. </p>
  
  <p>My latest approach looks like this:</p>
  
  <pre><code>var myscale = CGFloat()
  
  override func viewDidLoad() {
      super.viewDidLoad()
      // Do any additional setup after loading the view.
  
      mapView.delegate = self
  
      mapView.myLocationEnabled = true
  
      if let mylocation = mapView.myLocation {
          print(mylocation)
          // use for camera position later on
      }
      else {
          // do sth else
      }
  
      let camera = GMSCameraPosition.cameraWithLatitude(47.962433, longitude: 12.526859, zoom: 17)
      mapView.camera = camera
  
      let userImage = UIImage(named: "test_profile_pic.png")!
      let userIcon = UIImage(data: UIImagePNGRepresentation(userImage)!, scale: myscale)
  
      let marker = GMSMarker()
      marker.icon = userIcon
      marker.position = CLLocationCoordinate2DMake(45.962433, 13.526859)
      marker.title = "testMarker"
      marker.snippet = "testSnippet"
      marker.map = mapView
  
      segmentedControl.layer.cornerRadius = 5
      segmentedControl.layer.masksToBounds = true
  
  }
  func mapView(mapView: GMSMapView!, didChangeCameraPosition position: GMSCameraPosition!) {
      if (mapView.camera.zoom &lt;= 16) {
          myscale = 4.0
      }
      // as soon is this works, some fine tuning in scaling
  }
  </code></pre>
  
  <p>With this approach the image is not rescaling to value I set in <code>didChangeCameraPosition</code> as its already loaded with scale 1.0. I'm don't really get how I'm able to update the scale of my UIImage. Any help appreciated. </p>