You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 13, 2021. It is now read-only.
override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
let delete = UITableViewRowAction(style: .normal, title: "Delete") { action, index in
print("delete button tapped")
if let item = self.categories?[indexPath.row] {
do {
try self.realm.write {
//check mark on off
//item.done = !item.done
//delete it when done
self.realm.delete(item)
}
} catch {
print("Error saving done satus\(error)")
}
}
tableView.reloadData()
tableView.deselectRow(at: indexPath, animated: true)
}
//delete.backgroundColor = .red
let purpleColor = UIColor(red:0.99, green:0.00, blue:0.95, alpha:1.0)
let greenColor = UIColor(red:0.00, green:0.99, blue:0.22, alpha:1.0)
let colorArray = [purpleColor,greenColor]
delete.backgroundColor = UIColor(gradientStyle: UIGradientStyle.leftToRight, withFrame: delete.accessibilityFrame, andColors: [purpleColor,greenColor])
return [delete]
}
And make the swipe to delete background color of my row edit action be a gradient just for fun it does not seem to work. Instead it is a default? grey color.