UISheetPresentationController to present a sheets with UIKit

Sumanth Chidananda
2 min readJan 25, 2022

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.

UISheetPresentationController different height sizes

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

--

--

Sumanth Chidananda

Senior Professional iOS Developer developing iOS apps since 2011. Experience designing iOS, Android applications and technology solutions for enterprise apps