title: Text field four-sided border with animation
body: <p>I would like to highlight text field four-side border when user clicked inside and reverting back when user's editing end. To achieve this I have following code snippet inside editingDidBegin function of my text field.</p>
  
  <pre><code>func pulseBorderColor() {
      let pulseAnimation = CABasicAnimation(keyPath: "borderColor")
      pulseAnimation.duration = 0.35
      pulseAnimation.fromValue = UIColor.green.cgColor
      pulseAnimation.toValue = UIColor(red: 252/255, green: 180/255, blue: 29/255, alpha: 1.0).cgColor
      pulseAnimation.fillMode = kCAFillModeForwards
      pulseAnimation.isRemovedOnCompletion = false
      pulseAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
      nationalIdentityTextField.layer.sublayers![0].add(pulseAnimation,forKey: nil)
  }
  </code></pre>
  
  <p>And to revert back my text field color I have following code inside text field editingDidEnd function</p>
  
  <pre><code>func reversePulseBorderColor() {
      let pulseAnimation = CABasicAnimation(keyPath: "borderColor")
      pulseAnimation.duration = 0.35
      pulseAnimation.fromValue = UIColor(red: 252/255, green: 180/255, blue: 29/255, alpha: 1.0).cgColor
      pulseAnimation.toValue = UIColor.green.cgColor
      pulseAnimation.fillMode = kCAFillModeForwards
      pulseAnimation.isRemovedOnCompletion = false
      pulseAnimation.timingFunction = CAMediaTimingFunction(name:  kCAMediaTimingFunctionEaseInEaseOut)
      nationalIdentityTextField.layer.sublayers![0].add(pulseAnimation,forKey: nil)
  }
  </code></pre>
  
  <p>However, it could't achieve what I want. What could be the reason and how can I fix it?</p>