textInputFormattingControlVisibility
Specifies which system text formatting controls are available for people to format text.
View ModifieriOS 26.0+macOS 26.0+tvOS 26.0+watchOS 26.0+visionOS 26.0+textInputFormattingControlVisibility(_:for:) in SwiftUI
Declaration
compose().textInputFormattingControlVisibility(
visibility: SwiftUI.Visibility,
options: {
for: SwiftUI.TextInputFormattingControlPlacementSet;
}
)nonisolated func textInputFormattingControlVisibility(
_ visibility: Visibility,
for placement: TextInputFormattingControlPlacement.Set
) -> some ViewParameters
visibility*SwiftUI.VisibilityWhether the controls in the given placements may become visible.
options.for*SwiftUI.TextInputFormattingControlPlacementSet
Discussion
A TextEditor with a binding to an AttributedString offers
built-in controls for formatting text. These controls appear in
different placements depending on the platform. By default,
TextEditor shows them in the context menu and in the
keyboard toolbar on iOS. See TextInputFormattingControlPlacement.Set
for the available placements.
In this example, the formatting accessory bar is shown in a macOS editor:
struct StyledTextEditingView: View {
@State private var text: AttributedString = ""
var body: some View {
TextEditor(text: $text)
.textInputFormattingControlVisibility(.visible, for: .accessoryBar)
}
}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.