-
Notifications
You must be signed in to change notification settings - Fork 50
fixed crash on iOS12 and added dismiss handler #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b850582
1a826a9
2328271
95267ca
b45d13a
b3a7850
b3c5b49
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -95,8 +95,33 @@ public extension UIViewController { | |||||
| present(viewController, animated: true, completion: nil) | ||||||
| } | ||||||
|
|
||||||
| func presentBottomSheet(viewController: UIViewController, configuration: BottomSheetConfiguration, dissmisCompletion: @escaping (() -> Void)) { | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we make this option optional and nil by default and delete function above
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, can you please fix a typo?
Suggested change
|
||||||
| weak var presentingViewController = self | ||||||
| weak var currentBottomSheetTransitionDelegate: UIViewControllerTransitioningDelegate? | ||||||
| let presentationControllerFactory = DefaultBottomSheetPresentationControllerFactory(configuration: configuration) { | ||||||
| DefaultBottomSheetModalDismissalHandler(presentingViewController: presentingViewController) { | ||||||
| if currentBottomSheetTransitionDelegate === presentingViewController?.bottomSheetTransitionDelegate { | ||||||
| presentingViewController?.bottomSheetTransitionDelegate = nil | ||||||
| } | ||||||
| dissmisCompletion() | ||||||
| } | ||||||
| } | ||||||
| bottomSheetTransitionDelegate = BottomSheetTransitioningDelegate( | ||||||
| presentationControllerFactory: presentationControllerFactory | ||||||
| ) | ||||||
| currentBottomSheetTransitionDelegate = bottomSheetTransitionDelegate | ||||||
| viewController.transitioningDelegate = bottomSheetTransitionDelegate | ||||||
| viewController.modalPresentationStyle = .custom | ||||||
| present(viewController, animated: true, completion: nil) | ||||||
| } | ||||||
|
|
||||||
| func presentBottomSheetInsideNavigationController(viewController: UIViewController, configuration: BottomSheetConfiguration) { | ||||||
| let navigationController = BottomSheetNavigationController(rootViewController: viewController, configuration: configuration) | ||||||
| presentBottomSheet(viewController: navigationController, configuration: configuration) | ||||||
| } | ||||||
|
|
||||||
| func presentBottomSheetInsideNavigationController(viewController: UIViewController, configuration: BottomSheetConfiguration, dismissCompletion: @escaping (() -> Void)) { | ||||||
| let navigationController = BottomSheetNavigationController(rootViewController: viewController, configuration: configuration) | ||||||
| presentBottomSheet(viewController: navigationController, configuration: configuration, dissmisCompletion: dismissCompletion) | ||||||
| } | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this option is not needed let's just ignore it and remove
dismissCompletion?