Add completion block to present function (#94)
This commit is contained in:
parent
b012aecb6b
commit
b2f5bd7d16
|
|
@ -29,7 +29,10 @@ protocol PanModalPresenter: AnyObject {
|
|||
/**
|
||||
Presents a view controller that conforms to the PanModalPresentable protocol
|
||||
*/
|
||||
func presentPanModal(_ viewControllerToPresent: PanModalPresentable.LayoutType, sourceView: UIView?, sourceRect: CGRect)
|
||||
func presentPanModal(_ viewControllerToPresent: PanModalPresentable.LayoutType,
|
||||
sourceView: UIView?,
|
||||
sourceRect: CGRect,
|
||||
completion: (() -> Void)?)
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -35,10 +35,14 @@ extension UIViewController: PanModalPresenter {
|
|||
- viewControllerToPresent: The view controller to be presented
|
||||
- sourceView: The view containing the anchor rectangle for the popover.
|
||||
- sourceRect: The rectangle in the specified view in which to anchor the popover.
|
||||
- completion: The block to execute after the presentation finishes. You may specify nil for this parameter.
|
||||
|
||||
- Note: sourceView & sourceRect are only required for presentation on an iPad.
|
||||
*/
|
||||
public func presentPanModal(_ viewControllerToPresent: PanModalPresentable.LayoutType, sourceView: UIView? = nil, sourceRect: CGRect = .zero) {
|
||||
public func presentPanModal(_ viewControllerToPresent: PanModalPresentable.LayoutType,
|
||||
sourceView: UIView? = nil,
|
||||
sourceRect: CGRect = .zero,
|
||||
completion: (() -> Void)? = nil) {
|
||||
|
||||
/**
|
||||
Here, we deliberately do not check for size classes. More info in `PanModalPresentationDelegate`
|
||||
|
|
@ -55,7 +59,7 @@ extension UIViewController: PanModalPresenter {
|
|||
viewControllerToPresent.transitioningDelegate = PanModalPresentationDelegate.default
|
||||
}
|
||||
|
||||
present(viewControllerToPresent, animated: true, completion: nil)
|
||||
present(viewControllerToPresent, animated: true, completion: completion)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue