Skip to content

Commit

Permalink
Merge pull request #21 from finn-no/fix/dismiss-constraints
Browse files Browse the repository at this point in the history
Remove content view constraints on dismiss
  • Loading branch information
vadymmarkov authored Jan 14, 2020
2 parents 417d0c4 + 38118bd commit 485fd5f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/BottomSheetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ public final class BottomSheetView: UIView {
public func dismiss(velocity: CGPoint = .zero, completion: ((Bool) -> Void)? = nil) {
springAnimator.addCompletion { [weak self] didComplete in
if didComplete {
self?.contentView.constraints.forEach { constraint in
self?.contentView.removeConstraint(constraint)
}
self?.contentView.removeFromSuperview()
self?.dimView.removeFromSuperview()
self?.removeFromSuperview()
}
Expand Down Expand Up @@ -372,7 +376,7 @@ public final class BottomSheetView: UIView {
// MARK: - UITapGestureRecognizer

@objc private func handleTap(tapGesture: UITapGestureRecognizer) {
dismissalDelegate?.bottomSheetView(self, willDismissBy: .tap)
dismissalDelegate?.bottomSheetView(self, willDismissBy: .tap)
}

// MARK: - Offset calculation
Expand Down

0 comments on commit 485fd5f

Please sign in to comment.