All of the asked situations are now supported in iOS 15
Destructive: (works from iOS 15)
Set .destructive
as the role
argument of the button:
Button(role: .destructive) { // 👈 This argument
// delete something
} label: {
Label("Delete", systemImage: "trash")
}
Disabled: (works from iOS 14.2)
Add .disabled
modifier to the button.
Button {
// call someone
} label: {
Label("Call", systemImage: "phone")
}.disabled(true) // 👈 This modifier
Divider: (works from iOS 14)
Use a Divider()
view directly.
Full Demo:
⚠️ Remember! Do not use image
instead of systemImage
for showing an SFSymbol on the button!