UISheetPresentationController to present a sheets with UIKit
A presentation controller that manages the appearance and behaviour of a sheet.
UISheetPresentationController comes with customisation options like adjusting the height and adding a grabber to the top of the sheetPresentationController
Detents property of UISheetPresentationController allow different sheet sizes
We can add different size configurations to our sheets by defining detents in our presented view controller. Currently, there are only two predefined sizes for medium and large presentations.
Once set, our view controller uses the height of the first defined detent upon presentation.
In the above example, we defined medium first for ‘viewControllerToPresent’, so our ‘viewControllerToPresent’ is presented with a medium height.
Here we get the scrolling behaviour comes as a default to scroll between different detents
‘prefersGrabberVisible’ property provides ability to display the grabber on SheetPresentationController
By default ‘prefersGrabberVisible’ is false. By setting it to ‘true’ displays the grabber visible on SheetPresentationController