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
Tried this solution in Swift 4.1
let menuBar: UIView = {
let mb = UIView()
mb.backgroundColor = .red
mb.translatesAutoresizingMaskIntoConstraints = false
return mb
}()
private func setupMenuBar(){
view.addSubview(menuBar)
let constraints = [ menuBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
menuBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
menuBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
menuBar.heightAnchor.constraint(equalToConstant: 50)]
NSLayoutConstraint.activate(constraints)
}