Assumption:
I assume you have embedded UINavigationBar inside your Apple iOS app on Storyboard.
If you want to mimic the behaviour of the Apple Safari iOS App, such as hiding the navigation bar on the scroll, you can do it in just a single line of code without any hassle.
You have to add the following code in your View Controller’s viewDidAppear function where you have added UINavigationBar in the Storyboard:
navigationController?.hidesBarsOnSwipe = true
Now your viewDidAppear function will look like this:
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
navigationController?.hidesBarsOnSwipe = true
}
Hope it helps,
Thanks & Regards
Mandar Apte