I have this function in a class that inherits from NSObject
:
open func showCustomDialogInView(vc: UIViewController) {
let bundle = Bundle(for: CustomDialogViewController.self)
let customDialog = CustomDialogViewController(nibName: "CustomDialogViewController", bundle: bundle)
customDialog.delegate = vc
customDialog.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext
vc.present(customDialog, animated: true, completion: nil)
}
I had this working in one of my iOS projects before updating to Xcode 8
and Swift 3
language, but now when I run the app I get a crash when vc.present(customDialog, animated: true, completion: nil)
line is reached. I get this message in log console:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle /MyApp.app> (loaded)' with name 'CustomDialogViewController''
I don't understand what it is happening, since let customDialog = CustomDialogViewController(nibName: "CustomDialogViewController", bundle: bundle)
line doesn't crash and it seems that I get a CustomDialogViewController
object.
Does somebody could help me with this issue? Thanks