Skip to content

Commit

Permalink
Add delegate method
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasdelgado committed Oct 16, 2023
1 parent 4b2f875 commit f615033
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ open class OverlayContainerSheetPresentationController: OverlayContainerPresenta
}, completion: nil)
let policy = makeDismissalPolicy()
if !presentedViewController.isBeingDismissed && policy.shouldDismiss(using: dismissalContext) {
sheetDelegate?.overlayContainerSheetPresentationControllerDidDismiss()
presentingViewController.dismiss(animated: true, completion: nil)
}
}
Expand Down Expand Up @@ -96,6 +97,7 @@ open class OverlayContainerSheetPresentationController: OverlayContainerPresenta
@objc private func tapGestureAction(_ sender: UITapGestureRecognizer) {
let shouldDismiss = sheetDelegate?.overlayContainerSheetPresentationControllerShouldDismissOnTap(self) ?? true
guard shouldDismiss else { return }
sheetDelegate?.overlayContainerSheetPresentationControllerDidDismiss()
presentedViewController.dismiss(animated: true, completion: nil)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ public protocol OverlayContainerSheetPresentationControllerDelegate: AnyObject {
///
/// - parameter presentationController: The presentation controller requesting this information.
func overlayContainerSheetPresentationControllerShouldDismissOnTap(_ presentationController: OverlayContainerSheetPresentationController) -> Bool

func overlayContainerSheetPresentationControllerDidDismiss()
}

0 comments on commit f615033

Please sign in to comment.