I am trying to change a button\'s color (just a flash/blink) to green when a scan is correct and red when there\'s a problem. I am able to do this with a view like so
I hope that will solve your problem.
buttonScan.alpha = 1.0 UIView.animate(withDuration: 1.0, delay: 1.0, options: UIView.AnimationOptions.curveEaseOut, animations: { buttonScan.alpha = 0.0 }, completion: nil)