<!--
{
  "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/onAssignedDocumentWillWithdraw(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewP08ClassKitB0E30onAssignedDocumentWillWithdrawyQrSb10Foundation3URLVYacF"
  },
  "title" : "onAssignedDocumentWillWithdraw(_:)"
}
-->

# onAssignedDocumentWillWithdraw(_:)

Adds an action to perform before withdrawing an assigned document submission.

```
@MainActor @preconcurrency func onAssignedDocumentWillWithdraw(_ 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. Return `true` to continue, or `false` to cancel.

## Return Value

A view that executes the specified action before withdrawing an assigned document.

## Discussion

Return `true` to allow the withdrawal to proceed or `false` to cancel it.
This action confirms whether the person wants to withdraw their work.

```swift
AssignedDocumentSubmissionButton(documentURL: documentURL)
    .onAssignedDocumentWillWithdraw { url in
        // Confirm the person's intent
        let confirmed = await showConfirmation(
            "Are you sure you want to withdraw your document submission?"
        )
        return confirmed
    }
```

---

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)