Skip to content

Commit

Permalink
Add delay option
Browse files Browse the repository at this point in the history
  • Loading branch information
ppamorim committed May 7, 2020
1 parent 4807ac9 commit 21832f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CircularRevealKit.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'CircularRevealKit'
s.version = '0.9.3'
s.version = '0.9.4'
s.summary = 'Circular reveal animations made easy'
s.homepage = 'https://github.com/T-Pro/CircularRevealKit'
s.description = 'This library was created to allow developers to implement the material design reveal effect.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ public extension UIViewController {
duration: TimeInterval = DEFAULT_CIRCULAR_ANIMATION_DURATION,
startFrame: CGRect = CGRect.zero,
fadeColor: UIColor? = nil,
delay: TimeInterval = .zero,
_ completion: (() -> Void)? = nil) {
self.push(viewController, duration, startFrame, fadeColor, revealType: .reveal, completion)
self.push(viewController, duration, startFrame, fadeColor, delay, revealType: .reveal, completion)
}

func radialDismiss(
duration: TimeInterval = DEFAULT_CIRCULAR_ANIMATION_DURATION,
startFrame: CGRect = CGRect.zero,
fadeColor: UIColor? = nil,
delay: TimeInterval = .zero,
_ completion: (() -> Void)? = nil) {
self.push(nil, duration, startFrame, fadeColor, revealType: .unreveal, completion)
self.push(nil, duration, startFrame, fadeColor, delay, revealType: .unreveal, completion)
}

private func validateUINavigationController() -> Bool {
Expand Down Expand Up @@ -97,6 +99,7 @@ public extension UIViewController {
_ duration: TimeInterval = DEFAULT_CIRCULAR_ANIMATION_DURATION,
_ startFrame: CGRect = CGRect.zero,
_ fadeColor: UIColor?,
_ delay: TimeInterval,
revealType: RevealType = .reveal,
_ transitionCompletion: (() -> Void)? = nil) {

Expand Down Expand Up @@ -140,7 +143,7 @@ public extension UIViewController {
fromViewSnapshot.isHidden = true
transactionContext.containerView.addSubview(fromViewSnapshot)

DispatchQueue.main.asyncAfter(deadline: .now()) {
DispatchQueue.main.asyncAfter(deadline: .now() + delay) {

if let fadeView: UIView = fadeView {
fadeView.alpha = 0.01
Expand All @@ -162,7 +165,7 @@ public extension UIViewController {
duration: animationTime,
revealType: revealType) { () -> Void in

DispatchQueue.main.asyncAfter(deadline: .now()) {
DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
completion(true)
transitionCompletion?()
fromViewSnapshot.removeFromSuperview()
Expand All @@ -185,7 +188,7 @@ public extension UIViewController {
toViewSnapshot.isHidden = true
transactionContext.containerView.addSubview(toViewSnapshot)

DispatchQueue.main.asyncAfter(deadline: .now()) {
DispatchQueue.main.asyncAfter(deadline: .now() + delay) {

if let fadeView: UIView = fadeView {
fadeView.alpha = 1.0
Expand All @@ -212,7 +215,7 @@ public extension UIViewController {
duration: animationTime,
revealType: revealType) { () -> Void in

DispatchQueue.main.asyncAfter(deadline: .now()) {
DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
completion(true)
transitionCompletion?()
fromViewSnapshot.removeFromSuperview()
Expand Down

0 comments on commit 21832f7

Please sign in to comment.