In my table, I have an UITableViewRowAction
for editActionsForRowAtIndexPath
. When I press it, it will delete all the data in my array, resulting in triggering the didSet
on the array ending with the view changing. The code looks as follows:
var data: [Int] = [Int]() {
didSet {
if data.isEmpty {
// change view
}
}
}
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? {
var confirm = UITableViewRowAction(style: .Default, title: "Confirm") { (action: UITableViewRowAction!, indexPath: NSIndexPath!) -> Void in
self.data.removeAll(keepCapacity: false)
self.tableView.setEditing(false, animated: true)
}
return [confirm]
}
What I'd like to get is some kind of completion after the animation of the UITableViewRowAction
is finished (row moving back in it's place), then empty the array and changing the views. If possible I'd like to avoid using a manual delay.