Using Xcode 8.2
and Swift 2.3
I have a view controller files namVcc.swift and namVccUI.xib
I am trying to initialize the view controller from xib file but getting error
|*| Try 1 :
let namVccVar = UINib(nibName: "namVccUI", bundle:
nil).instantiateWithOwner(nil, options: nil)[0] as! namVcc
navigationController?.pushViewController(namVccVar, animated: true)
|*| Try 2 :
let namVccVar = namVcc(nibName: "namVccUI", bundle: nil)
navigationController?.pushViewController(namVccVar, animated: true)
Error: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'namVccUI'
I also checked the properties of xib file > Target Membership and it's checked.
What else could be the problem?