diff --git a/EasyAnimation.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/EasyAnimation.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/EasyAnimation.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/EasyAnimation/EAAnimationFuture.swift b/EasyAnimation/EAAnimationFuture.swift index 356aedb..11492fc 100644 --- a/EasyAnimation/EAAnimationFuture.swift +++ b/EasyAnimation/EAAnimationFuture.swift @@ -133,6 +133,33 @@ public class EAAnimationFuture: Equatable, CustomStringConvertible { return nextDelayedAnimation! } + /** + Waits the specified duration. + + :param: duration The wait duration in seconds. + + :returns: The created request. + */ + public func wait(_ duration: TimeInterval) -> EAAnimationFuture { + return animate(withDuration: 0, delay: duration, options: [], animations: {}, completion: nil) + } + + /** + Runs the code in the input block without animating. + + :param: block The block of code to run + + :returns: The created request. + */ + @discardableResult + public func `do`(_ block: @escaping () -> Void) -> EAAnimationFuture { + return animate(withDuration: 0, animations: {}) { _ in + DispatchQueue.main.async { + block() + } + } + } + //MARK: - Animation control methods /** diff --git a/EasyAnimation/EasyAnimation.swift b/EasyAnimation/EasyAnimation.swift index 9622f52..5cec907 100644 --- a/EasyAnimation/EasyAnimation.swift +++ b/EasyAnimation/EasyAnimation.swift @@ -398,6 +398,19 @@ extension UIView { // MARK: chain animations + /** + Creates and runs an animation which allows other animations to be chained to it and to each other. + + :param: duration The animation duration in seconds + :param: animations Animation closure + :param: completion Completion closure of type (Bool)->Void + + :returns: The created request. + */ + public class func animateAndChain(withDuration duration: TimeInterval, animations: @escaping () -> Void) -> EAAnimationFuture { + return UIView.animateAndChain(withDuration: duration, delay: 0, options: [], animations: animations, completion: nil) + } + /** Creates and runs an animation which allows other animations to be chained to it and to each other.