iOS 16: Bottom Sheets
Sheets were introduced in SwiftUI with iOS 13. This year, however, they get a small upgrade. Finally, with iOS 16, you can set the height of the sheet yourself.
There are several built-in settings, such as.
- Medium: Uses half of the screen height
- Large: Uses the full screen height.
But also individually configurable sizes:
- Fraction: Uses the defined fraction of the screen height.
- Custom: You can slice your own presentation logic
- Fixed Height: Fixed defined height
You can configure these settings with .presentationDetents, also combinations are possible.
Using .presentationDragIndicator you can show or hide the indicator that you can see in the top center image.
Example Code
If you want to try it out by yourself, here is an example code:
If you are interested in more iOS 16 feature videos, check out the following playlist.