swipeActionsContainer

Coordinates swipe action dismissal and mutual exclusion across rows in a container.

View ModifieriOS 27.0+macOS 27.0+watchOS 27.0+visionOS 27.0+swipeActionsContainer() in SwiftUI

Declaration

React
compose().swipeActionsContainer()
Swift
nonisolated func swipeActionsContainer() -> some View

Discussion

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.