<!--
{
  "availability" : [
    "iOS: 26.4.0 -",
    "iPadOS: 26.4.0 -",
    "macOS: 26.4.0 -",
    "visionOS: 26.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/onAssignedDocumentWillSubmit(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewP08ClassKitB0E28onAssignedDocumentWillSubmityQrSb10Foundation3URLVYacF"
  },
  "title" : "onAssignedDocumentWillSubmit(_:)"
}
-->

# onAssignedDocumentWillSubmit(_:)

Adds an action to perform before submitting an assigned document.

```
@MainActor @preconcurrency func onAssignedDocumentWillSubmit(_ action: @escaping @Sendable (URL) async -> Bool) -> some View
```

## Parameters

`action`

An asynchronous closure that receives the document URL and
returns a Boolean value indicating whether to proceed with submission. Return
`true` to continue, or `false` to cancel.

## Return Value

A view that executes the specified action before assigned document submission.

## Discussion

Return `true` to allow the submission to proceed, or `false` to
cancel the submission. This is useful for validating document content,
confirming user intent, or performing prerequisite operations.

```swift
AssignedDocumentSubmissionButton(documentURL: documentURL)
    .onAssignedDocumentWillSubmit { url in
        // Validate the assigned document before submission
        guard await isDocumentComplete(url) else {
            await showAlert("Please complete all sections before submitting")
            return false // Prevents submission
        }
        return true // Allows submission to continue
    }
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)