static let cancel: ButtonRole
A role that indicates a button that cancels an operation.
Availability 有効性
Technology
static let destructive: ButtonRole
Use this role for a button that deletes user data, or performs an irreversible operation. A destructive button signals by its appearance that the user should carefully consider whether to tap or click the button. For example, SwiftUI presents a destructive button that you add with the swipe
modifier using a red background:
List {
ForEach(items) { item in
Text(item.title)
.swipeActions {
Button(role: .destructive) { delete() } label: {
Label("Delete", systemImage: "trash")
}
}
}
}
.navigationTitle("Shopping List")
static let cancel: ButtonRole