title: optimal approach to animate radar in iOS
body: <p>I'm trying to animate the heading line of a naval-style radar (the spinning part below) in iOS, like this:</p>
  
  <p><a href="https://i.stack.imgur.com/jNDPv.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jNDPv.gif" alt="radar image"></a></p>
  
  <p>My current slow, laggy, and high-overhead solution (pseudocode because the real Swift code is a little lengthy):</p>
  
  <pre><code>create NSTimer to call animate() every 1/60 sec
  currentAngle = 0
  
  animate():
      create UIBezierPath from center of circle to outside edge at currentAngle
      add path to new CAShapeLayer, add layer to views layer
      add fade out CABasicAnimation to layer (reduces opacity over time)
      increase currentAngle
  </code></pre>
  
  <p>What's the best way to do this without using a .gif? I have implemented the solution above, but the performance (frame rate and CPU use) is awful. How would you approach this problem?</p>