submitScope
Prevents submission triggers originating from this view to invoke a submission action configured by a submission modifier higher up in the view hierarchy.
Declaration
compose().submitScope(isBlocking?: boolean)nonisolated func submitScope(_ isBlocking: Bool = true) -> some ViewParameters
isBlockingbooleanA Boolean that indicates whether this scope is actively blocking submission triggers from reaching higher submission actions.
Discussion
Use this modifier when you want to avoid specific views from initiating
a submission action configured by the View.onSubmit(of:_:) modifier.
In the example below, the tag field doesn't trigger the submission of
the form:
Form {
TextField("Username", text: $viewModel.userName)
SecureField("Password", text: $viewModel.password)
TextField("Tags", text: $viewModel.tags)
.submitScope()
}
.onSubmit {
guard viewModel.validate() else { return }
viewModel.login()
}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.