A Boolean that indicates whether this scope is actively blocking submission triggers from reaching higher submission actions.
Instance Method
インスタンスメソッド
submit
submitScope(_:)
Prevents submission triggers originating from this view to invoke a submission action configured by a submission modifier higher up in the view hierarchy.
Availability 有効性
- iOS 15.0+
- iPadOS 15.0+
- macOS 12.0+
- Mac Catalyst 15.0+
- tvOS 15.0+
- watchOS 8.0+
Technology
- Swift
UI
Declaration 宣言
Parameters パラメータ
isBlocking
Discussion 議論
Use this modifier when you want to avoid specific views from initiating a submission action configured by the on
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()
}