Did you know iOS 26 introduces a new button initializer that only takes a role and an action as parameters?
Based on the role, a fully localized label with a custom icon is generated. This also provides a native way to get the sheet close and confirm buttons.

#iOSDev #SwiftUI

@Typ0genius I was wondering where this feature went. We used to have it in like iPhone OS 2.0 for Done buttons etc.
@tobias I am too young to know that 😅 But I highly appreciate having a uniform definition for common buttons. I assume this is also a welcoming change for improving accessibility.
@Typ0genius UIBarButtonSystemItem used to have lots of constants.

@Typ0genius Too bad the toolbar versions of .cancel and .close are indistinguishable.

As is, the only way for the user to know which one it is, is by looking for a companion .confirm button.

It would make (more) sense if .close was e.g. the checkmark without the highlight.

@teilweise Honestly, I think this is fine. There is no scenario (at least in Apple's apps) where we need a close and cancel button in the same view. Yes, if there is a confirm button, it is a cancel button, as it indicates a loss of something. If there isn't something to lose, it is a close button. I think a checkmark for close wouldn't be appropriate when we look at the red window close button on macOS, which also uses an x.