Accessing NSView in Nib file inside a framework

I have a framework with a Nib file containing an NSView. How can I access the NSView from within the framework?
One way to achieve this, is to create a class that will be the "file owner" of the nib file. Often, it will be a subclass of NSWindowController if you have a window in your nib file. Make one of its instance variable pointing to your view: NSView *ibMyView. Let's say the window controller is of class MYWinController, then you create and to your project both the MYWinController.h and MYWinController.m files.
In
MYWinController.m, you override the init method:
- (id)init
{
return [[super init] initWithWindowNibName:@"MYNIBFILENAME"];
}
You don't have to be more precise regarding where the framework is installed: Cocoa will resolve this for you: the same init will work for various install location (inside the aplication bundle or the Library/Frameworks) — as long as the framework is actually linked to your project…
You can make it a singleton, if you prefer not loading a new one each time you need the view.

- (id)init
{
static MYWinController *_controller = nil ;

if (_controller == nil)
_controller = [[super init] initWithWindowNibName:@"MYNIBFILENAME"];

return _controller ;
}
You then add an accessor to get the pointer to the wiew:
- (NSView *)myView
{
return ibMyView ;
}
Of course, you never need to actually display the window under control of the MYWinController if you don't need to…
Now what if you don't have or don't want a
NSWindowController in the nib file ?
Look at
NSBundle documentation, several methods are available to get a class from a bundle:
principalClass will return the class of the owner object (as defined in the Info.plist file of the bundle), you can make your view the owner of the object and then something like [myBundle principalClass] alloc] initWithFrame:myFrame]; (You can initialize the myBundle variable with [NSBundle bundleWithpath:myPath]…)
There is also classNamed:(NSString *)className, that you can use if you make your view a subclass of NSView…
Once you have the class you need, [[myClass alloc] init]