Path to bundle of iOS framework
Try below code to get the custom bundle:
let bundlePath = Bundle.main.path(forResource: "CustomBunlde", ofType: "bundle")
let resourceBundle = Bundle.init(path: bundlePath!)
Update
If in your framework, try this:
[[NSBundle bundleForClass:[YourClass class]] URLForResource:@"YourResourceName" withExtension:@".suffixName"];
Use Bundle(for:Type)
:
let bundle = Bundle(for: type(of: self))
let path = bundle.path(forResource: filename, ofType: type)
or search the bundle by identifier
(the frameworks bundle ID):
let bundle = Bundle(identifier: "com.myframework")
Swift 5
let bundle = Bundle(for: Self.self)
let path = bundle.path(forResource: "filename", ofType: ".plist")