I'm trying to implement a new iOS11 feature that allows you to officially use an image in a tableview swipe action.
so, I came up with this:
@available(iOS 11.0, *)
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let deleteAction = UIContextualAction(style: .normal, title: "", handler: { (ac:UIContextualAction, view:UIView, success:(Bool) -> Void) in
//whatever
success(true)
})
let theImage: UIImage? = UIImage(named:"Delete")?.withRenderingMode(.alwaysOriginal)
deleteAction.image = theImage
return UISwipeActionsConfiguration(actions: [deleteAction])
}
I have this .png sitting in my assets catalog.
I tried WITH and WITHOUt the rendering mode. In either case, the image is correctly shown in the debugger:
but fails to show up in the Simulator ("Nothing here" marks the place where I would expect the image to show up):
Am I doing something wrong?