Skip to content

Commit

Permalink
The CADisplayLink should be invalidated after use (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
Torsph authored Jan 29, 2021
1 parent c491c25 commit e985c82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions Sources/BottomSheetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ public final class BottomSheetView: UIView {
self?.contentView.removeFromSuperview()
self?.dimView.removeFromSuperview()
self?.removeFromSuperview()
self?.springAnimator.invalidate()
}

completion?(didComplete)
Expand Down
4 changes: 4 additions & 0 deletions Sources/SpringAnimator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ class SpringAnimator: NSObject {
state = .stopped
completion?(!withoutFinishing)
}

func invalidate() {
displayLink.invalidate()
}
}

private extension SpringAnimator {
Expand Down

0 comments on commit e985c82

Please sign in to comment.