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")
|
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 {
|
switch mode {
|
||||||
|
@ -126,8 +136,10 @@ struct ComposeAttachmentRow: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func removeAttachment() {
|
private func removeAttachment() {
|
||||||
|
withAnimation {
|
||||||
draft.attachments.removeAll { $0.id == attachment.id }
|
draft.attachments.removeAll { $0.id == attachment.id }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func editDrawing() {
|
private func editDrawing() {
|
||||||
uiState.composeDrawingMode = .edit(id: attachment.id)
|
uiState.composeDrawingMode = .edit(id: attachment.id)
|
||||||
|
|
Loading…
Reference in New Issue