title: Indicating error by making UI element blink
body: <p>I have a view where the user needs to make a selection before a button will work. To make this more obvious, I want to have the element that represents the selection that needs to be done blink if the (greyed-out) button is pressed first. I.e. I want to indicate that this is an error in that state and lead the user's attention to the UI element they need to use first.</p>
  
  <p>My current attempt to have the element (<code>self.display</code> in the code below) quickly blink two times is the following:</p>
  
  <pre><code>@IBAction func inactiveButtonClick() {
      let period = 0.16
  
      UIView.animate(withDuration: period/2, delay: 0.0, options: [.curveEaseInOut, .autoreverse, .repeat], animations: {
          self.display.alpha = 0
      }, completion: { _ -&gt; Void in
          self.display.alpha = 1
      })
  
      DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + period*2, execute: {
          self.display.layer.removeAllAnimations()
      })
  
  }
  </code></pre>
  
  <p>This works <em>quite</em> well, but doesn't feel 100% right, and the animation is sometimes cut off fractions of a second before it finishes. I guess I could queue two animations, but I wonder if there is an easier way of accomplishing this. Are there any built-in ways to have a UI element blink to indicate an error? If not, are there any “known good” combinations of curves and frequencies that convey this to a user?</p>