Fix crash with large image dismiss gesture
This commit is contained in:
parent
3aa45cb365
commit
af5a0b7bbd
|
@ -25,7 +25,14 @@ class LargeImageInteractionController: UIPercentDrivenInteractiveTransition {
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func handleGesture(_ recognizer: UIPanGestureRecognizer) {
|
@objc func handleGesture(_ recognizer: UIPanGestureRecognizer) {
|
||||||
let translation = recognizer.translation(in: recognizer.view!.superview!)
|
guard let recognizerSuperview = recognizer.view?.superview else {
|
||||||
|
// Assume the gesture has ended b/c we don't have a view/superview anymore.
|
||||||
|
inProgress = false
|
||||||
|
direction = nil
|
||||||
|
cancel()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let translation = recognizer.translation(in: recognizerSuperview)
|
||||||
var progress = translation.y / 200
|
var progress = translation.y / 200
|
||||||
if let direction = direction {
|
if let direction = direction {
|
||||||
progress *= direction
|
progress *= direction
|
||||||
|
@ -63,7 +70,7 @@ class LargeImageInteractionController: UIPercentDrivenInteractiveTransition {
|
||||||
|
|
||||||
override func cancel() {
|
override func cancel() {
|
||||||
super.cancel()
|
super.cancel()
|
||||||
viewController.isInteractivelyAnimatingDismissal = false
|
viewController?.isInteractivelyAnimatingDismissal = false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue