I know how to add this element with HStack
and Rectangle
. But...
How is it called?
Does SwiftUI have this element out of the box?
I don't think there's one accepted name for it; I usually call it a drag handle as it's there to indicate a draggable area to users.
There is no built-in syntax to add one to a sheet. That's the benefit of SwiftUI – simple controls are easy to implement and customize.
For completeness, you can make one using something like the following:
VStack {
Capsule()
.fill(Color.secondary)
.frame(width: 30, height: 3)
.padding(10)
// your sheet content here
Spacer()
}