Alex Alex - 16 days ago 4x
Swift Question

View controls do not show up using Interface Builder

Even I'm a Swift beginner, it should be simple but I don't know why. I'm not keen to use Storyboard so I decided to go for the Interface Builder. After adding several elements into my view controller, they are not showing up when I run my app. The following is my code:

window = UIWindow.init(frame: UIScreen.main.bounds)
let home = HomeViewController()
window!.rootViewController = home

I've already set
to the
File's Owner


The problem would be this line:

let home = HomeViewController()

You should change it to

let home = HomeViewController(nibName: "Whatever the name of your xib file is", bundle: nil)