My framework's XIB uses custom view classes and it cannot access these files because Cocoapods bundles them separately.
Podspec example:
s.source_files = 'TheFramework/**/*.{swift}'
s.resource_bundles = {
'MyResourceBundle' => ['TheFramework/Assets/*.xib', 'TheFramework/Assets/*.xcassets']
}
I have two use cases...
1. Framework built as a pod
In this case I can access the Swift classes by setting the custom view module as the target name "TheFramework" and it works.
2. Framework archived
In this can I can check the "Inherit module from target" box to help it get the correct module for the Swift class since the module is no longer named "TheFramework". However, now the case above built as a pod won't work because the inherited module name would be MyResourceBundle (since this is where the XIB exists) and the Swift files are not in the MyResourceBundle.
Workarounds attempted
- Tried placing the Xibs in s.resources instead but in this case they cannot access the xcassets that are still in the bundle. Moving the xcassets also to resources causes a whole set of other issues.
- Tried not using any custom classes within the Xib and instead only setting them from the ViewController and this works fine but it's not great and confusing for future work.