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!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…