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
| import UIKit | |
| class ViewController: UIViewController { | |
| // The view that draws the hexagon outline. | |
| let hexagonView = HexagonView() | |
| // The ball view. | |
| let ballView = UIView(frame: CGRect(x: 0, y: 0, width: 30, height: 30)) | |
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 | |
| } |