The code bellow works in iOS 10. I can swipe the cell to left and keep its 'trickView' fixed on the edge of the UITableView. But it does not work in iOS 11. (The swipe animation is done by UITableViewRowAction)
If there is someone know how to make it work on iOS 11, I will be appreciate.
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CellId", for: indexPath) as! SomeBeautifulCell
if cell.fixedLeadingConstraint == nil {
let constraint = NSLayoutConstraint(item: cell.trickView, attribute: .leading, relatedBy: .equal, toItem: tableView, attribute: .leading, multiplier: 1, constant: 10)
cell.fixedLeadingConstraint = constraint
DispatchQueue.main.async {
tableView.addConstraint(constraint)
}
}
return cell
}