In My Project, there is one framework project and this framework project has images in the assets catalog..
I want to use theses images using the storyboard of my main project.
I can use the images in class files by defining the bundle of the framework like this,
myImageView.image = UIImage(named: "img1", in: Bundle.init(identifier: "com.abc"), compatibleWith: nil)
but not in the storyboard. so Can I use it in storyboard or I have to go using code only ?
Open your XCode Project. Just go to File -> Add Files to... (your Project) -> Assets. xcassets and you are good to go!
You cannot use assets of other frameworks directly, but you can add the assets to your main target as reference:
"Add Files to Project.xcodeproj..."
You will then be able to choose the images of the assets container in the attributes inspector of image views and buttons.
Please follow below steps to user framework image assets.
Create bundle resource for your framework project
Add your required images into that bundle resource
Build your framework and drag that framework into your project
Also drag and drop that bundle resource into your project from framework package.
Use any images into your storyboard which you added into the bundle resources.
Please refer below image for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With