Large title to small title switch in navigation bar is not smooth iOS 13, sticky

Swift 5, Xcode 13:

UIViewController(1) + UINavigationController:

override func viewDidLoad() {
    super.viewDidLoad()

    navigationController?.navigationBar.prefersLargeTitles = true
    navigationItem.title = "Your title here"
}

UIViewController(2 - "i.e.: detailsViewController"):

override func viewDidLoad() {
    super.viewDidLoad()
    
    navigationItem.largeTitleDisplayMode = .never
    navigationItem.title = "Your title here"
}

It works like a charm!


What you're doing was always wrong. You should set prefersLargeTitles to true once for the navigation bar and never touch it again.

The way to change what each view controller does about large titles as it appears is that that view controller sets its own navigationItem (in its viewDidLoad) to have the desired largeTitleDisplayMode. So if the first v.c. has .always and the second has .never everything will be smooth.