Created
December 8, 2020 17:52
-
-
Save aleksandr-lavrinenko/ca43ca5e8dbd4588ea040bc528c04d41 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protocol TemplateImageAddable { | |
| func set(image: UIImage?) | |
| } | |
| extension TemplateImageAddable where Self: UIImageView { | |
| func set(image: UIImage?) { | |
| self.image = image?.withRenderingMode(.alwaysTemplate) | |
| } | |
| } | |
| extension TemplateImageAddable where Self: UIButton { | |
| func set(image: UIImage?) { | |
| setImage(image?.withRenderingMode(.alwaysTemplate), for: .normal) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment