Safe area layout is introduced in iOS11 but what can we do if we are supporting < iOS 11 and we have a xib view that is initiated in a ViewController and somehow the upper part of the xib view appears behind the NavigationBar??? To fix this, simply add this line in your
self.edgesForExtendedLayout = UIRectEdge.init(rawValue: 0)
For more information visit EdgesForExtendedLayout at Apple.
We know how to embed a ViewController in a NavigationController in Storyboard. However, I came across a scenario where I had to initiate it programmatically. The code:
let viewController = MyViewController()
let nav = UINavigationController(rootViewController: viewController)
self.navigationController?.present(nav, animated: true, completion: nil)
In Xcode you will need to remove the intermediate build information at some point. If you are having build issues, removing derived data works like magic.
Keyboard shortcut in Xcode:
rm -rf ~/Library/Developer/Xcode/DerivedData