Skip to content

Commit

Permalink
Fix transition, view controller leak and add fade transition
Browse files Browse the repository at this point in the history
  • Loading branch information
ppamorim committed May 2, 2020
1 parent f9b542a commit a437e8b
Show file tree
Hide file tree
Showing 12 changed files with 298 additions and 200 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.1'
s.version = '0.9.2'
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
14 changes: 10 additions & 4 deletions CircularRevealKit/Classes/CicularTransactionDirector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@ import UIKit
public typealias AnimationBlock = ((
_ transactionContext: UIViewControllerContextTransitioning,
_ animationTime: TimeInterval,
_ transitionCompletion: @escaping () -> Void) -> Void)
_ transitionCompletion: @escaping (_ didComplete: Bool) -> Void) -> Void)

public class CicularTransactionDirector: NSObject {

public var duration: TimeInterval = DEFAULT_CIRCULAR_ANIMATION_DURATION
public var transitionContext: UIViewControllerContextTransitioning?
public var animationBlock: AnimationBlock?

deinit {
animationBlock = nil
}

}

extension CicularTransactionDirector: UIViewControllerAnimatedTransitioning {
Expand All @@ -45,8 +49,8 @@ extension CicularTransactionDirector: UIViewControllerAnimatedTransitioning {

public func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
self.transitionContext = transitionContext
self.animationBlock?(transitionContext, duration) {
transitionContext.completeTransition(true)
self.animationBlock?(transitionContext, duration) { (didComplete: Bool) in
transitionContext.completeTransition(didComplete)
}
}

Expand All @@ -56,7 +60,9 @@ extension CicularTransactionDirector: UIViewControllerInteractiveTransitioning {

public func startInteractiveTransition(_ transitionContext: UIViewControllerContextTransitioning) {
self.transitionContext = transitionContext
self.animationBlock?(transitionContext, duration) { }
self.animationBlock?(transitionContext, duration) { (didComplete: Bool) in
transitionContext.completeTransition(didComplete)
}
}

}
Expand Down
4 changes: 4 additions & 0 deletions CircularRevealKit/Classes/LayerAnimator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ class LayerAnimator: NSObject, CAAnimationDelegate {

func animationDidStop(_ anim: CAAnimation, finished flag: Bool) {
animLayer?.removeAllAnimations()
animLayer = nil
caAnimation = nil
completionBlock?()
completionBlock = nil

}

}
Loading

0 comments on commit a437e8b

Please sign in to comment.