You need a custom back button. On your destination view controller create a custom UIButtonItem, set it as your leftBarButtonItem and perform an animation on button's action.
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "back", style: .plain, target: self, action: #selector(self.back))
}
@objc func back(){
//Create and set up the animation
let transition = CATransition()
transition.duration = 0.4
transition.type = kCATransitionMoveIn
transition.subtype = kCATransitionFromRight//animates from right to left
self.navigationController?.view.layer.add(transition, forKey: nil)//adds the animation
self.navigationController?.popViewController(animated: true)
}