swipeActionsContainer
Coordinates swipe action dismissal and mutual exclusion across rows in a container.
Declaration
compose().swipeActionsContainer()nonisolated func swipeActionsContainer() -> some ViewDiscussion
Apply this modifier to a ScrollView or other
container that holds rows using the
View.swipeActions(edge:allowsFullSwipe:content:)
modifier. The container ensures that:
- Only one row's swipe actions are revealed at a time.
- Scrolling the container dismisses any open actions.
- Tapping outside the active row dismisses its actions.
List provides this coordination automatically.
Use swipeActionsContainer() when building custom
row-based layouts that use ScrollView,
LazyVStack, or similar containers.
ScrollView {
LazyVStack {
ForEach(items) { item in
ItemRow(item)
.swipeActions {
Button("Delete", role: .destructive) {
delete(item)
}
}
}
}
}
.swipeActionsContainer()Applying this modifier to a List is a no-op,
since List already provides this coordination.
See also
More in Lists and tables.
- deleteDisabledAdds a condition for whether the view's view hierarchy is deletable.
- listItemTintSets the tint effect for content in a list.
- listRowBackgroundPlaces a custom background view behind a list row item.
- listRowInsetsSets the insets of rows in a list on the specified edges.
- listRowSeparatorSets the display mode for the separator associated with this specific row.
- listRowSeparatorTintSets the tint color associated with a row.
- listRowSpacingSets the vertical spacing between two adjacent rows in a List.
- listSectionIndexVisibilityChanges the visibility of the list section index.
- listSectionMarginsSet the section margins for the specific edges.
- listSectionSeparatorSets whether to hide the separator associated with a list section.
- listSectionSeparatorTintSets the tint color associated with a section.
- listSectionSpacingSets the spacing between adjacent sections in a List to a custom value.