title: Swift4 Animation using Timer.scheduledTimer
body: <p>I'm animating a clock hand that takes a CGFloat value from 0 to 1.  While I have the animation, I would like it to be a lot smoother.  The total animation takes 5 seconds, as part of an input variable.  How can I make this a lot smoother?  </p>
  
  <p>Ideally, I'd like to get all the values from 0 to 1 in 5 seconds...</p>
  
  <p>The clock hand does a complete 360 but is a little choppy</p>
  
  <pre><code>@IBAction func start(_ sender: Any) {
  
      timer = Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(launchTimer), userInfo: nil, repeats: true)
  
      launchTimer()
  }
  
   func launchTimer()  {
  
      guard seconds &lt; 4.9 else {
  
          timer.invalidate()
          seconds = 0
  
          return
      }
  
      seconds += 0.1
  
      clockView.currentPressure = CGFloat(seconds / 5)
      clockView.setNeedsDisplay()
  
  }
  </code></pre>
  
  <p>EDIT</p>
  
  <pre><code>import UIKit
  
  class GaugeView: UIView {
  
      var currentPressure : CGFloat = 0.0
  
      override func draw(_ rect: CGRect) {
          StyleKitName.drawGauge(pressure: currentPressure)
      }
  }
  </code></pre>