iPhone SwiftUI layouts
Explore SwiftUI APIs, components, and modifiers with interactive iPhone previews, Swift code, and Apple documentation. Compare every available orientation, appearance, and design.
201elements
Button
EditButton
A button that toggles the edit mode environment value
Explore EditButton on iPhone in portrait, with SwiftUI code and Apple API documentation.
SwiftUI code
@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()
}
}Compatibility
iOS 13.0+ iPadOS 13.0+ visionOS 1.0+
Tags
Found an issue or have a suggestion?
All variants
Every available iPhone screenshot for EditButton.