just downloaded xcode 9 and i\'m having this weird issue, on ios 11 my custom navbar appears to be half in size and is under the status bar, on ios 10 works fine.
so
Try adding some Auto Layout constraints after you add the nav bar to the view
if #available(iOS 11.0, *) {
newNavbar.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
newNavbar.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
newNavbar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor).isActive = true
newNavbar.heightAnchor.constraint(equalToConstant: 64).isActive = true
}
You can actually use all but the third constraint in earlier versions of iOS but if it all works in earlier versions you may not want to mess with it.
Using the safe layout area should keep your nav bar under the status bar.