I've implemented a custom control in a OS X application that works fine. When the control is drawn it uses code from a non system Framework. The control is written in swift, the framework is in Objective-C. The Framework is not built in the same project or workspace as the application with the custom control. I've added the Framework to the target and added it to a copy files build phase.
When I add the IBDesignable decoration to the custom control class in swift then I get an error when trying to view the control in Interface Builder. The error I get is:
file:///Users/ktam/github/MovingImagesDemo/Spinner2/SpinnerController.xib: error: IB Designables: Failed to render instance of Spinner:
dlopen(Spinner2.app, 1): Library not loaded: @executable_path/../Frameworks/MovingImages.framework/Versions/A/MovingImages
Referenced from: Spinner2.app
Reason: image not found
When I check the application bundle created in the IBDesignables sub folder the framework is in the correct place in the application bundle. I'm assuming that the executable actually being run in this case is not the one in the IBDesignables application bundle but possibly an Interface Builder executable of some kind which explains why the Framework image is not able to be loaded.
What do I need to do to load code that Interface Builder can find when it renders a view with IBDesignable?
Info after further testing:
I rebuilt the Framework while specifying the installation directory to be ~/Library/Frameworks and then copied the built Framework to that location, I then updated the application target so that the Runpath search paths included ~/Library/Frameworks and both the Application and Interface Builder draw the custom control correctly now.
This is not the solution I need but it points to what the problem is, I still need to work out what the proper fix is.