Contents

swipeActionsContainer()

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

Declaration

nonisolated func swipeActionsContainer() -> some View

Discussion

Apply this modifier to a ScrollView or other container that holds rows using the 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

Container controls