scenee / FloatingPanel

A clean and easy-to-use floating panel UI component for iOS
MIT License
5.61k stars 510 forks source link

fatalError in method interruptibleAnimator #641

Closed LevinIvan closed 3 months ago

LevinIvan commented 3 months ago

Description

Hi. In our company, we use FloatingPanel and our users experience a crash in Transitioning.swift:122

    func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
        guard
            let fpc = transitionContext?.viewController(forKey: .from) as? FloatingPanelController
        else { fatalError()} // here

        let animator = fpc.animatorForDismissing(with: .zero)
        return TimeInterval(animator.duration)
    }

Unfortunately, we cannot catch this bug and understand what is happening. We have tried to reproduce it in various ways.

I would like to ask two questions:

  1. Why do you call fatalError()? It seems to me too dangerous to use fatal Error in production :(
  2. Is it possible to remove fatalError() and return, for example, 0.0?

I would appreciate your prompt response. 🙏

Expected behavior

Actual behavior

Environment

Library version

Installation method

iOS version(s)

Xcode version

LevinIvan commented 3 months ago

@scenee

scenee commented 3 months ago

This issue has been resolved in #642. Thanks