Last active
June 26, 2017 07:40
-
-
Save mitsuse/375e234da49c2243493a322efba320ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UIViewController { | |
public func present( | |
_ viewController: UIViewController, | |
with transitioningDelegate: UIViewControllerTransitioningDelegate, | |
completion: (() -> Void)? = nil | |
) { | |
viewController.transitioningDelegate = transitioningDelegate | |
viewController.modalPresentationStyle = .custom | |
self.present(viewController, animated: true) { [transitioningDelegate] in | |
completion?() | |
_ = transitioningDelegate | |
} | |
} | |
public func dismiss(with transitioningDelegate: UIViewControllerTransitioningDelegate, completion: (() -> Void)? = nil) { | |
self.transitioningDelegate = transitioningDelegate | |
self.dismiss(animated: true) { [transitioningDelegate] in | |
completion?() | |
_ = transitioningDelegate | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment