I am animating a tableView cell selection from with the didSelectRow at method, which is working. My code is as follows :
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let cell = tableView.cellForRow(at: indexPath)
UIView.animate(withDuration: 0.2, animations: {
cell!.transform = CGAffineTransform(scaleX: 0.97, y: 0.97)
}, completion: { finished in
UIView.animate(withDuration: 0.2) {
cell!.transform = .identity
}
})
}
I'd like to be able to put this in the custom class file for the cell but don't know where to start. Is this possible ?
Thankyou