Swipe Action
Adds custom swipe actions to a row in a list or container, notifying you when the actions are revealed or dismissed.
Platform Compatibility
Tags
SwiftUI Code
@State private var isSwiped = false
var body: some View {
VStack {
Text("Trailing Swipe")
.swipeActions {
Button(role: .destructive, action: action)
}
Text("Leading Swipe")
.swipeActions(edge: .leading) {
Button(role: .destructive, action: action)
}
Text("Stateful Swipe")
.swipeActions {
Button(role: .destructive, action: action)
} onPresentationChanged: {
isSwiped = $0
}
Text("Swipe state: \(isSwiped ? "active" : "inactive")")
}
}
Found an issue or have a suggestion?
More View Components
View allToolbar Vertical Edge
This value reflects the system’s preferred edge for the vertical bar in the current context, regardless of whether a vertical bar is currently visible. Use it to position custom bars or other UI relative to the system’s bar placement.
Music Picker
Presents a music picker to select items from the Apple Music catalog and the user’s music library.
Explore Other Components
Browse allCustom Icon Store View
Creates a view to load a collection of products from the App Store using product identifiers, and merchandise them using a custom image.
Text Format
Creates a text view that displays the formatted representation of a nonstring type supported by a corresponding format style.
TabView Bottom Accessory Placement
A placement of the bottom accessory in a tab view. You can use this to adjust the content of the accessory view based on the placement