EditButton

A button that toggles the edit mode environment value

EditButton - iOS Light Mode Preview

Platform Compatibility

iOS 13.0+ iPadOS 13.0+ visionOS 1.0+

Tags

SwiftUI Code

Docs
@Environment(\.editMode) private var editMode
    @State private var name = "Foo"

    var body: some View {
      HStack {
        
        if editMode?.wrappedValue.isEditing == true {
          TextField("Name", text: $name)
        } else {
          Text(name)
        }
          EditButton()
      }
    }

Found an issue or have a suggestion?

Created: June 3, 2025Updated: June 3, 2025