I have created cocoa touch framework where I have created UIViewController class which has the ui in xib file. I have done required binding between xib and controller files like file owner connecting to controller class.
I have created another xib and controller files in separate project as normal ios app. There I tried to present this ViewController it was coming on to the screen but when I tried to load the controller present in framework only black screen was coming up to screen.
I have added xib files in copy bundle resources part of build phases in xcode. But when I pod install the framework locally I am able to see only controller file along with other swift files but not the xib ones.
let oPController = OPController() let oNav = UINavigationController(rootViewController: oPController) controller.present(oNav, animated: true, completion: nil) Is there any special care to be taken when framework contains xib files?
Note When I look in the installed pods in project I cannot see any xib files there.
Bundleto load xib from. When you useinitwithout parameters, it will useBundle.mainwhich is not the correct one in this case. Of course, the framework bundle has to be copied correctly during the build.copy bundle resources?OPController(nibName: nil, bundle: Bundle(for: OPController.self)first. That should make sure the xib is loaded from the correct bundle.