mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Saved message search
This commit is contained in:
@@ -994,6 +994,35 @@ public extension ContainedViewLayoutTransition {
|
||||
}
|
||||
}
|
||||
|
||||
func updateTintColor(view: UIView, color: UIColor, completion: ((Bool) -> Void)? = nil) {
|
||||
if let current = view.tintColor, current == color {
|
||||
completion?(true)
|
||||
return
|
||||
}
|
||||
|
||||
switch self {
|
||||
case .immediate:
|
||||
view.tintColor = color
|
||||
completion?(true)
|
||||
case let .animated(duration, curve):
|
||||
let previousColor: CGColor = view.layer.layerTintColor ?? UIColor.clear.cgColor
|
||||
view.tintColor = color
|
||||
|
||||
view.layer.animate(
|
||||
from: previousColor,
|
||||
to: color.cgColor,
|
||||
keyPath: "contentsMultiplyColor",
|
||||
timingFunction: curve.timingFunction,
|
||||
duration: duration,
|
||||
delay: 0.0,
|
||||
mediaTimingFunction: curve.mediaTimingFunction,
|
||||
removeOnCompletion: true,
|
||||
additive: false,
|
||||
completion: completion
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func updateContentsRect(layer: CALayer, contentsRect: CGRect, completion: ((Bool) -> Void)? = nil) {
|
||||
if layer.contentsRect == contentsRect {
|
||||
if let completion = completion {
|
||||
|
||||
Reference in New Issue
Block a user