Skip to content
This repository was archived by the owner on Jun 16, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CardPresentationController/CardConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public struct CardConfiguration {
/// Set to false to disable interactive dismissal
public var allowInteractiveDismissal = true

/// A completion block runs after dismiss the presented view controller
public var dismissCompletion: (() -> Void)? = nil

/// Default initializer, with most suitable values
init() {}

Expand All @@ -55,7 +58,8 @@ extension CardConfiguration {
cornerRadius: CGFloat? = nil,
backFadeAlpha: CGFloat? = nil,
initialTransitionFrame: CGRect? = nil,
allowInteractiveDismissal: Bool? = nil)
allowInteractiveDismissal: Bool? = nil,
dismissCompletion: (() -> Void)? = nil)
{
if let verticalSpacing = verticalSpacing {
self.verticalSpacing = verticalSpacing
Expand Down Expand Up @@ -88,5 +92,9 @@ extension CardConfiguration {
if let allowInteractiveDismissal = allowInteractiveDismissal {
self.allowInteractiveDismissal = allowInteractiveDismissal
}

if let dismissCompletion = dismissCompletion {
self.dismissCompletion = dismissCompletion
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public class CardPresentationController: UIPresentationController {
cardAnimator.isInteractive = true

// and then initiate dismissal
presentedViewController.dismiss(animated: true)
presentedViewController.dismiss(animated: true, completion: configuration.dismissCompletion)

case .changed:
if !hasStartedPan { return }
Expand Down