Add context menu action to remove attachments in Compose
This commit is contained in:
parent
27e05cc72d
commit
ebb0770198
|
@ -41,6 +41,16 @@ struct ComposeAttachmentRow: View {
|
|||
Label("Recognize Text", systemImage: "doc.text.viewfinder")
|
||||
}
|
||||
}
|
||||
|
||||
if #available(iOS 15.0, *) {
|
||||
Button(action: self.removeAttachment) {
|
||||
Label("Delete", systemImage: "trash")
|
||||
}.foregroundStyle(.red)
|
||||
} else {
|
||||
Button(action: self.removeAttachment) {
|
||||
Label("Delete", systemImage: "trash")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch mode {
|
||||
|
@ -126,7 +136,9 @@ struct ComposeAttachmentRow: View {
|
|||
}
|
||||
|
||||
private func removeAttachment() {
|
||||
draft.attachments.removeAll { $0.id == attachment.id }
|
||||
withAnimation {
|
||||
draft.attachments.removeAll { $0.id == attachment.id }
|
||||
}
|
||||
}
|
||||
|
||||
private func editDrawing() {
|
||||
|
|
Loading…
Reference in New Issue