i have created a framework out of my existing code base and tried using it in a new code base. This worked fine. But my application is getting crashed when i try to access the nib files which is a part of my framework bundle. This is the code i am using to access the view controllers XIB file.
testViewController *controller = [[testViewController alloc] initWithNibName:@"testViewController" bundle:nil];
[self.view addSubview:controller.view];
The app is getting crashed without generating any error or crash report. Here aremy questions
1 - Can we add xib files in our framework
2 - If, yes, what is the correct way to add and access the nib(xib)files from a framawork(currently i have added them in the "compile sources" section of my "build phases" tab in "build settings")
You need to write the name of the bundle in which you nib. files are store so change your above code to ...
here your bundle is an object of type NSBundle. refer the NSBundle class for more info
In swift 2 - For storyboard :
For XIB:
Swift 3 Storyboard:
Xib
Here bundle name is the bundle id of framework.