This file contains 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
import UIKit | |
extension UIImage { | |
func tint(tintColor: UIColor) -> UIImage { | |
return modifiedImage { context, rect in | |
// draw black background - workaround to preserve color of partially transparent pixels | |
context.setBlendMode(.normal) | |
UIColor.black.setFill() |