Skip to content

Commit

Permalink
Manually Merged #39
Browse files Browse the repository at this point in the history
  • Loading branch information
andreamazz committed Apr 23, 2018
1 parent c5a7886 commit 2e2f58a
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions Source/BubbleTransition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ extension BubbleTransition: UIViewControllerAnimatedTransitioning {
let fromViewController = transitionContext.viewController(forKey: .from)
let toViewController = transitionContext.viewController(forKey: .to)

fromViewController?.beginAppearanceTransition(false, animated: true)
toViewController?.beginAppearanceTransition(true, animated: true)

if transitionMode == .present {
fromViewController?.beginAppearanceTransition(false, animated: true)
if toViewController?.modalPresentationStyle == .custom {
toViewController?.beginAppearanceTransition(true, animated: true)
}

let presentedControllerView = transitionContext.view(forKey: UITransitionContextViewKey.to)!
let originalCenter = presentedControllerView.center
let originalSize = presentedControllerView.frame.size
Expand All @@ -130,9 +132,16 @@ extension BubbleTransition: UIViewControllerAnimatedTransitioning {
transitionContext.completeTransition(true)
self.bubble.isHidden = true
fromViewController?.endAppearanceTransition()
toViewController?.endAppearanceTransition()
if toViewController?.modalPresentationStyle == .custom {
toViewController?.endAppearanceTransition()
}
})
} else {
if fromViewController?.modalPresentationStyle == .custom {
fromViewController?.beginAppearanceTransition(false, animated: true)
}
toViewController?.beginAppearanceTransition(true, animated: true)

let key = (transitionMode == .pop) ? UITransitionContextViewKey.to : UITransitionContextViewKey.from
let returningControllerView = transitionContext.view(forKey: key)!
let originalCenter = returningControllerView.center
Expand All @@ -159,7 +168,9 @@ extension BubbleTransition: UIViewControllerAnimatedTransitioning {
self.bubble.removeFromSuperview()
transitionContext.completeTransition(true)

fromViewController?.endAppearanceTransition()
if fromViewController?.modalPresentationStyle == .custom {
fromViewController?.endAppearanceTransition()
}
toViewController?.endAppearanceTransition()
})
}
Expand Down

0 comments on commit 2e2f58a

Please sign in to comment.