mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
12 lines
343 B
Swift
12 lines
343 B
Swift
|
import UIKit
|
||
|
|
||
|
public extension UIImage {
|
||
|
|
||
|
func withTint(_ color: UIColor) -> UIImage? {
|
||
|
let template = self.withRenderingMode(.alwaysTemplate)
|
||
|
let imageView = UIImageView(image: template)
|
||
|
imageView.tintColor = color
|
||
|
return imageView.toImage(isOpaque: imageView.isOpaque, scale: UIScreen.main.scale)
|
||
|
}
|
||
|
}
|