Skip to content

fatalError in method interruptibleAnimator #641

@LevinIvan

Description

@LevinIvan

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

  • Do not crash the application, but return some value/error.

Actual behavior

  • The application crashes.

Environment

Library version

  • 2.5.5

Installation method

  • Swift Package Manager

iOS version(s)

  • Any

Xcode version

  • 15.10.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions