Hide large title when scrolling up

For me, it was that if you set the boolean "Prefers Large Titles" in the storyboard to true it will stay large, if you turn this on by code it works as expected!


I found a workaround on this site basically, if the tableView (or element that has scroll)is not the first view in your view hierarchy, the large title fails to hide automatically.

Example that will NOT workExample that will work

https://markusbodner.com/2017/10/08/fix-large-navigation-bar-title-not-hiding-on-scroll-in-ios-11/

I added on the view willAppear:

if #available(iOS 11.0, *) {
    navigationController?.navigationBar.prefersLargeTitles = true
} else {
    // Fallback on earlier versions
}