View ModifieriOS 16.0+macOS 13.0+tvOS 16.0+watchOS 9.0+
Overloads
2 ways to call compose().renameAction(). Each is one SwiftUI overload, picked by the arguments you pass.
compose().renameAction(isFocused: Binding<boolean>)nonisolated func renameAction(
_ isFocused: FocusState<Bool>.Binding
) -> some ViewParameters
isFocused*Binding<boolean>The focus binding to update when activating the rename action.
Return value
A view that has the specified rename action.
Discussion
Use this modifier in conjunction with the RenameButton to implement
standard rename interactions. A rename button receives its action
from the environment. Use this modifier to customize the action
provided to the rename button.
struct RowView: View {
@State private var text = ""
@FocusState private var isFocused: Bool
var body: some View {
TextField(text: $item.name) {
Text("Prompt")
}
.focused($isFocused)
.contextMenu {
RenameButton()
// ... your own custom actions
}
.renameAction($isFocused)
}When someone taps the rename button in the context menu, the rename
action focuses the text field by setting the isFocused
property to true.
See also
More in Other modifiers.
- contentMarginsConfigures the content margin for a provided placement.
- idBinds a view's identity to the given proxy value.
- modifierApplies a modifier to a view and returns a new view.
- persistentSystemOverlaysSets the preferred visibility of the non-transient system views overlaying the app.
- tagSets the unique tag value of this view.
- typeSelectEquivalentSets an explicit type select equivalent text in a collection, such as a list or table.