issue with interactive transition
Banck opened this issue · 7 comments
Hello!
Brach: Development.
Version: 2.0.0
Issue: I have a UINavigationController with some viewControllers. And I have a PhotoController which will dismiss interactively.
PhotoController has modalPresentationStyle = .custom
.
Simple code for interactive dismiss:
func pan() {
let translation = panGR.translation(in: nil)
let progress = abs(translation.y / 2 / collectionView!.bounds.height)
switch panGR.state {
case .began:
motionDismissViewController()
case .changed:
MotionTransition.shared.update(TimeInterval(progress))
if let cell = collectionView?.visibleCells[0] as? ScrollingImageCell {
let currentPos = CGPoint(x: translation.x + view.center.x, y: translation.y + view.center.y)
MotionTransition.shared.apply(modifiers: [.position(currentPos)], to: cell.imageView)
}
default:
if progress + abs(panGR.velocity(in: nil).y) / collectionView!.bounds.height > 0.3 {
MotionTransition.shared.finish()
} else {
MotionTransition.shared.cancel()
}
}
}
The issue is if MotionTransition.shared.cancel()
is called, then viewWillDisappear
will be called on the previous controller and after that viewWillDisappear and viewWillAppear
won't be called on every controllers in the UINavigationController (which was under PhotoController).
If comment these lines in MotionTransition.swift
:
then all is fine.
Could you please check. Thanks
Thank you for bringing this to our attention. @OrkhanAlikhanov will you take a look at this? Thanks buddy!
@OrkhanAlikhanov When using modalPresentationStyle = .overCurrentContext
, your PR fix is not working, I've got the same case, in .custom
, it will work fine
@mumensh Can you please send a sample app here?
@OrkhanAlikhanov Here is a sample for the issue, try run the project and tap on the images then try to dismiss them by panning in the first tab, then go to the second tap and try to tap on the images, it will not work. if you change the modalPresentationStyle
to .custom
, it will work fine.
Hey @mumensh I played with your project.
- I believe you wanted to use
.overFullScreen
not.overCurrentContext
. - There is no need to
break
at the end of eachcase
in swift. - I removed your
SecondViewController
. - I renamed your
ThirdViewController
toImageViewController
. - #63 Is meant to
fix unbalanced calls appearance method
logs issue, which is not an issue for your case.
@OrkhanAlikhanov Thank you very much :)