跳转至
Enumeration

EditMode

The mode of a view indicating whether the user can edit its content.

Declaration

enum EditMode

Overview

struct ExampleView: View {
    @State var fruits = ["🍌", "🍏", "🍑"]

    var body: some View {
        List {
            ForEach(fruits, id: \.self) { fruit in
                Text(fruit)
            }
            .onDelete { offets in
                fruits.remove(atOffsets: offets)
            }
        }
        .environment(\.editMode, .constant(.active))
    }
}
A gif displaying a view containing a list with three members; the gif shows two of the items being deleted from the list.

Availability

iOS 13.0+

tvOS 13.0+

Topics


Case

active The view content can be edited.

inactive The view content cannot be edited.

transient The view is in a temporary edit mode.


Instance Method

hash(into:) Hashes the essential components of this value by feeding them into the given hasher.


Instance Property

hashValue The hash value.

isEditing Indicates whether a view is being edited.


Type Method

==(a:b:) Returns a Boolean value indicating whether two values are equal.