Skip to content

Instantly share code, notes, and snippets.

@madcato
Last active March 23, 2020 06:26
Show Gist options
  • Save madcato/c0e570d7dc80d458927dc7272c073f24 to your computer and use it in GitHub Desktop.
Save madcato/c0e570d7dc80d458927dc7272c073f24 to your computer and use it in GitHub Desktop.
UIImage that continuously blink. "Assign it in the storyboard"
import UIKit
class BlinkingImage: UIImageView {
override func awakeFromNib() {
super.awakeFromNib()
UIView.animate(withDuration: 1.2,
delay: 0.0,
options: [.autoreverse, .repeat, .curveEaseInOut],
animations: {
self.alpha = 0.10
}, completion: nil)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment