title: How to rotate image based on angle in Swift?
body: <p>I'm trying to rotate and image to visually show the direction to a user like a compass. So I'm trying to feed an angle to a function to rotate the image in the angle's direction, but the image just spins out of control and doesn't seem to be correct when it finally stops. This function is getting called every time the delegate fires: <code>locationManager(manager: CLLocationManager!, didUpdateHeading newHeading: CLHeading!)</code>. Can someone point me in the right direction?</p>
  
  <pre><code>func headingDidChange(headingAngle: Double) {
      UIView.animateWithDuration(1.0, animations: {
          self.compassImage.transform = CGAffineTransformMakeRotation(CGFloat(headingAngle))
      })
  }
  </code></pre>