Created
May 20, 2024 08:16
-
-
Save evarilci/2b81a5a12aedc8965114069b245d379f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| extension UIViewController { | |
| func showBottomSheet(_ bottomSheet: UIViewController) { | |
| if #available(iOS 16.0, *) { | |
| if let sheetPresentationController = bottomSheet.presentationController as? UISheetPresentationController { | |
| sheetPresentationController.detents = [.custom(resolver: {context in | |
| 250})] | |
| sheetPresentationController.prefersGrabberVisible = true | |
| } | |
| } else { | |
| if let sheetPresentationController = bottomSheet.presentationController as? UISheetPresentationController { | |
| sheetPresentationController.detents = [.medium()] | |
| sheetPresentationController.prefersGrabberVisible = true | |
| } | |
| } | |
| present(bottomSheet, animated: true, completion: nil) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment