Declaration
compose().replaceDisabled(isDisabled?: boolean)nonisolated func replaceDisabled(_ isDisabled: Bool = true) -> some ViewParameters
isDisabledbooleanA Boolean value that indicates whether text replacement in the find and replace interface is disabled.
Return value
A view that disables the replace feature of a find and replace interface.
Discussion
Add this modifier to ensure that people can't activate the replace
feature of a find and replace interface for a TextEditor:
TextEditor(text: $text)
.replaceDisabled()If you want to disable both find and replace, use the
View.findDisabled(_:) modifier instead.
Using this modifer also disables the replace feature of a find and
replace interface that you present programmatically using the
View.findNavigator(isPresented:) method. Be sure to place the
disabling modifier closer to the text editor for this to work:
TextEditor(text: $text)
.replaceDisabled(isDisabled)
.findNavigator(isPresented: $isPresented)If you apply this modifer at multiple levels of a view hierarchy, the call closest to the text editor takes precedence. For example, people can activate find and replace for the first text editor in the following example, but only find for the second:
VStack {
TextEditor(text: $text1)
.replaceDisabled(false)
TextEditor(text: $text2)
}
.replaceDisabled(true)See also
More in Text and symbols.
- allowsTighteningSets whether text in this view can compress the space between characters when necessary to fit text in a line.
- autocorrectionDisabledSets whether to disable autocorrection for this view.
- baselineOffsetSets the vertical offset for the text relative to its baseline in this view.
- boldApplies a bold font weight to the text in this view.
- findDisabledPrevents find and replace operations in a text editor.
- findNavigatorProgrammatically presents the find and replace interface for text editor views.
- fontSets the default font for text in this view.
- fontDesignSets the font design of the text in this view.
- fontWeightSets the font weight of the text in this view.
- fontWidthSets the font width of the text in this view.
- interactionActivityTrackingTagSets a tag that you use for tracking interactivity.
- italicApplies italics to the text in this view.