diff --git a/Tusker/Screens/Drafts/DraftsTableViewController.swift b/Tusker/Screens/Drafts/DraftsTableViewController.swift index 3a981864..81a0a829 100644 --- a/Tusker/Screens/Drafts/DraftsTableViewController.swift +++ b/Tusker/Screens/Drafts/DraftsTableViewController.swift @@ -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() {