From 8ab3c11c83f56d648336c42b86937fd1da744522 Mon Sep 17 00:00:00 2001 From: Shin Yamamoto Date: Thu, 1 Sep 2022 19:53:55 +0900 Subject: [PATCH] Replace PR #551 change using fatalError() --- Sources/Transitioning.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/Transitioning.swift b/Sources/Transitioning.swift index 8b52141c..88ab2348 100644 --- a/Sources/Transitioning.swift +++ b/Sources/Transitioning.swift @@ -99,15 +99,15 @@ class ModalPresentTransition: NSObject, UIViewControllerAnimatedTransitioning { return animator } - // Ensure the current(initial) state is hidden. Because `fpc.transitionAnimator` can be nil if not. - fpc.move(to: .hidden, animated: false) - fpc.suspendTransitionAnimator(true) fpc.show(animated: true) { [weak fpc] in fpc?.suspendTransitionAnimator(false) transitionContext.completeTransition(!transitionContext.transitionWasCancelled) } - return fpc.transitionAnimator! + guard let transitionAnimator = fpc.transitionAnimator else { + fatalError("The panel state must be `hidden` but it is `\(fpc.state)`") + } + return transitionAnimator } func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {