Skip to content

Commit 4dd52b1

Browse files
authored
Replace PR #551 change using fatalError() (#563)
This resolves issue #561. Instead of continuing to work a modal presentation transition even if a panel state is not .hidden, this library calls fatalError as a programmer error on the occasion.
1 parent aef914e commit 4dd52b1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/Transitioning.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ class ModalPresentTransition: NSObject, UIViewControllerAnimatedTransitioning {
9999
return animator
100100
}
101101

102-
// Ensure the current(initial) state is hidden. Because `fpc.transitionAnimator` can be nil if not.
103-
fpc.move(to: .hidden, animated: false)
104-
105102
fpc.suspendTransitionAnimator(true)
106103
fpc.show(animated: true) { [weak fpc] in
107104
fpc?.suspendTransitionAnimator(false)
108105
transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
109106
}
110-
return fpc.transitionAnimator!
107+
guard let transitionAnimator = fpc.transitionAnimator else {
108+
fatalError("The panel state must be `hidden` but it is `\(fpc.state)`")
109+
}
110+
return transitionAnimator
111111
}
112112

113113
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {

0 commit comments

Comments
 (0)