Q:

cocoa touch framework assets not visible in App Project

I've been trying since morning creating a cocoa touch farmework to put my self containing widget inside it, and to allow any app I'm working on to use it in the future.
I've managed to build the project and export .framework file, but all the assets are not showing now. all my Images are inside assets catalog.
And they seem to be exported since the .framework file has (assets.car) file inside it.
I'm currently accessing them using 
UIImage* icon = [UIImage imageNamed:@"iconName"];

But it always returns null, Any ideas ?

A:

You can supply the framework bundle when creating an image. In Swift 2:
class func getMyImage() -> UIImage? {
    let bundle = NSBundle(forClass: self)
    return UIImage(named: "YourImageName", inBundle: bundle, compatibleWithTraitCollection: nil)
}

Swift 3:
class func getMyImage() -> UIImage? {
    let bundle = Bundle(for: type(of: self))
    return UIImage(named: "YourImageName", in: bundle, compatibleWith: nil)
}

Here is a demo project containing a framework with an image and an app that uses it.
https://github.com/marketplacer/AssetFrameworkDemo

