Create a Detent with a Custom Height in iOS 16

Stuart Breckenridge June 7, 2022
Source
Prior to iOS 16, UISheetPresentationController only supported two detents: medium and large. With iOS 16, we can now create our own detent with a custom height. sheetPresentationController?.detents = [.medium(), .large()] In iOS 16, create a detent identifier and then create a detent with that identifier and provide a maximum height. let smallId = UISheetPresentationController.Detent.Identifier("small") let smallDetent = UISheetPresentationController.Detent.custom(identifier: smallId) { context in return 80 } sheetPresentationController?.detents = [smallDetent, .medium(), .large()]

Discussion in the ATmosphere

Loading comments...