I'm going to try to explain this as well as I can, so please bear with me.
I have a table view populated with cells, I am trying to make it so when the tableViewCell
is pressed it opens a VC with the details of the object described by the cell. I thought I got it working, but I noticed that if you back out of the new VC back to page with the tableView
then press another cell, it does a transition as though it was going to a new page, but it still shows the page with the table view until you touch the screen (anywhere)
I was told it may not be a good idea to initialize a new VC within the function as I have done below as it may cause an increase of memory use, but whenever I try to initialize it anywhere else I get nothing but errors. I'm genuinely stuck.
Please note that the reason why I'm not using the built in segue function xCode provides is because this is a custom animation, so any solution which does away with the custom animation will not work.
It's very frustrating to have something almost working, but then little details break it. Any recommendations are appreciated, Thank you (code below)
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let exerciseDetailsVC = storyboard?.instantiateViewController(withIdentifier: "ExerciseDetailsVC") as! ExerciseDetailsVC
exerciseDetailsVC.exerciseIndex = indexPath.row
presentDetail(exerciseDetailsVC)
}
EDIT: Requested presentDetail function
func presentDetail (_ viewControllerToPresent: UIViewController){
let transition = CATransition()
transition.duration = 0.2
transition.type = CATransitionType.push
transition.subtype = CATransitionSubtype.fromRight
self.view.window?.layer.add(transition, forKey: kCATransition)
present(viewControllerToPresent, animated: false, completion: nil)
}