Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
- //Compartir
- let shareAction = UITableViewRowAction(style: .default, title: "Compartir") { (action, indexPath) in
- let shareDefaultText = "Estoy mirando la receta de \(self.recipes[indexPath.row].name!) en la App de David Fraj Blesa"
- let activityController = UIActivityViewController(activityItems: [shareDefaultText, self.recipes[indexPath.row].image!], applicationActivities: nil)
- self.present(activityController, animated: true, completion: nil)
- }
- shareAction.backgroundColor = UIColor(red: 30.0/255.0, green: 164.0/255.0, blue: 253.0/255.0, alpha: 1.0)
- //Borrar
- let deleteAction = UITableViewRowAction(style: .default, title: "Borrar") { (action, indexPath) in
- self.recipes.remove(at: indexPath.row)
- self.tableView.deleteRows(at: [indexPath], with: .fade)
- }
- deleteAction.backgroundColor = UIColor(red: 202.0/255.0, green: 202.0/255.0, blue: 202.0/255.0, alpha: 1.0)
- return [shareAction, deleteAction]
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement