mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Refactoring
This commit is contained in:
@@ -17,7 +17,7 @@ public extension UIView {
|
||||
}
|
||||
|
||||
private extension CALayer {
|
||||
func animate(from: AnyObject, to: AnyObject, keyPath: String, duration: Double, delay: Double, curve: Transition.Animation.Curve, removeOnCompletion: Bool, additive: Bool, completion: ((Bool) -> Void)? = nil) {
|
||||
func animate(from: AnyObject, to: AnyObject, keyPath: String, duration: Double, delay: Double, curve: ComponentTransition.Animation.Curve, removeOnCompletion: Bool, additive: Bool, completion: ((Bool) -> Void)? = nil) {
|
||||
let timingFunction: String
|
||||
let mediaTimingFunction: CAMediaTimingFunction?
|
||||
switch curve {
|
||||
@@ -44,7 +44,7 @@ private extension CALayer {
|
||||
}
|
||||
}
|
||||
|
||||
private extension Transition.Animation.Curve {
|
||||
private extension ComponentTransition.Animation.Curve {
|
||||
func asTimingFunction() -> CAMediaTimingFunction {
|
||||
switch self {
|
||||
case .easeInOut:
|
||||
@@ -59,7 +59,7 @@ private extension Transition.Animation.Curve {
|
||||
}
|
||||
}
|
||||
|
||||
public extension Transition.Animation {
|
||||
public extension ComponentTransition.Animation {
|
||||
var isImmediate: Bool {
|
||||
if case .none = self {
|
||||
return true
|
||||
@@ -69,7 +69,7 @@ public extension Transition.Animation {
|
||||
}
|
||||
}
|
||||
|
||||
public struct Transition {
|
||||
public struct ComponentTransition {
|
||||
public enum Animation {
|
||||
public enum Curve {
|
||||
case easeInOut
|
||||
@@ -111,19 +111,19 @@ public struct Transition {
|
||||
return nil
|
||||
}
|
||||
|
||||
public func withUserData(_ userData: Any) -> Transition {
|
||||
public func withUserData(_ userData: Any) -> ComponentTransition {
|
||||
var result = self
|
||||
result._userData.append(userData)
|
||||
return result
|
||||
}
|
||||
|
||||
public func withAnimation(_ animation: Animation) -> Transition {
|
||||
public func withAnimation(_ animation: Animation) -> ComponentTransition {
|
||||
var result = self
|
||||
result.animation = animation
|
||||
return result
|
||||
}
|
||||
|
||||
public func withAnimationIfAnimated(_ animation: Animation) -> Transition {
|
||||
public func withAnimationIfAnimated(_ animation: Animation) -> ComponentTransition {
|
||||
switch self.animation {
|
||||
case .none:
|
||||
return self
|
||||
@@ -134,14 +134,14 @@ public struct Transition {
|
||||
}
|
||||
}
|
||||
|
||||
public static var immediate: Transition = Transition(animation: .none)
|
||||
public static var immediate: ComponentTransition = ComponentTransition(animation: .none)
|
||||
|
||||
public static func easeInOut(duration: Double) -> Transition {
|
||||
return Transition(animation: .curve(duration: duration, curve: .easeInOut))
|
||||
public static func easeInOut(duration: Double) -> ComponentTransition {
|
||||
return ComponentTransition(animation: .curve(duration: duration, curve: .easeInOut))
|
||||
}
|
||||
|
||||
public static func spring(duration: Double) -> Transition {
|
||||
return Transition(animation: .curve(duration: duration, curve: .spring))
|
||||
public static func spring(duration: Double) -> ComponentTransition {
|
||||
return ComponentTransition(animation: .curve(duration: duration, curve: .spring))
|
||||
}
|
||||
|
||||
public init(animation: Animation) {
|
||||
@@ -1184,7 +1184,7 @@ public struct Transition {
|
||||
}
|
||||
}
|
||||
|
||||
public func animateContentsImage(layer: CALayer, from fromImage: CGImage, to toImage: CGImage, duration: Double, curve: Transition.Animation.Curve, completion: ((Bool) -> Void)? = nil) {
|
||||
public func animateContentsImage(layer: CALayer, from fromImage: CGImage, to toImage: CGImage, duration: Double, curve: ComponentTransition.Animation.Curve, completion: ((Bool) -> Void)? = nil) {
|
||||
layer.animate(
|
||||
from: fromImage,
|
||||
to: toImage,
|
||||
|
||||
Reference in New Issue
Block a user