mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
16 lines
438 B
Swift
16 lines
438 B
Swift
//
|
|
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension UIImage {
|
|
@objc
|
|
public func asTintedImage(color: UIColor) -> UIImage? {
|
|
let template = self.withRenderingMode(.alwaysTemplate)
|
|
let imageView = UIImageView(image: template)
|
|
imageView.tintColor = color
|
|
|
|
return imageView.renderAsImage(opaque: imageView.isOpaque, scale: UIScreen.main.scale)
|
|
}
|
|
}
|