onAssignedDocumentWillWithdraw(_:)
Adds an action to perform before withdrawing an assigned document submission.
Declaration
@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
trueto continue, orfalseto 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.
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
}