Add context menu action for deleting draft so it's accessible by cursor
This commit is contained in:
parent
92efee6f46
commit
f702df2f15
|
@ -110,6 +110,18 @@ class DraftsTableViewController: UITableViewController {
|
|||
tableView.deleteRows(at: [indexPath], with: .automatic)
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, contextMenuConfigurationForRowAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? {
|
||||
return UIContextMenuConfiguration(actionProvider: { _ in
|
||||
return UIMenu(children: [
|
||||
UIAction(title: "Delete Draft", image: UIImage(systemName: "trash"), attributes: .destructive, handler: { [unowned self] _ in
|
||||
DraftsManager.shared.remove(self.draft(for: indexPath))
|
||||
drafts.remove(at: indexPath.row)
|
||||
tableView.deleteRows(at: [indexPath], with: .automatic)
|
||||
})
|
||||
])
|
||||
})
|
||||
}
|
||||
|
||||
// MARK: - Interaction
|
||||
|
||||
@objc func cancelPressed() {
|
||||
|
|
Loading…
Reference in New Issue