The backBarButtonItem
works for the view controller that you are going back TO not the one you are going back FROM.
So, in your case in the first view controller you can have the code...
navigationItem.backBarButtonItem = UIBarButtonItem(title: "Some title", style: .done, target: nil, action: nil)