fix animator crash

This commit is contained in:
Levitating Pineapple
2024-10-07 21:24:07 +03:00
parent 56922c6323
commit c2c689ca91

View File

@@ -62,6 +62,11 @@ struct SheetRepresentable<Content: View>: UIViewControllerRepresentable {
@available(*, unavailable)
required init?(coder: NSCoder) { fatalError("init(coder:) missing") }
deinit {
animator.stopAnimation(true)
animator.finishAnimation(at: .current)
}
func animate(isPresented: Bool) {
let alreadyAnimating = animator.isRunning && isPresented != animator.isReversed
let sheetFullyDismissed = animator.fractionComplete == (animator.isReversed ? 1 : 0)