I've had a similar issue as you had here.
I wanted to import Swift generated Header from Objective C within the same cocoapod, but the header is in different locations depending on the type of library (and therefore the presence or absence of use_frameworks!).
I've managed to import the correct file in both cases without having to change the Podfile.
What i did
In order to have the header imported in both static library (without use_frameworks!) and dynamic framework (with use_frameworks!) i used something i found out here:
There basically is a compiler preprocessor macro __has_include ( header-name )
to find out if it actually has an import file in that specific location.
So, in case the file is there, I use that import, otherwise I use the other one (assuming there is no third options).
So in my case the import look like this:
#if defined __has_include && __has_include(<MyLibrary-Swift.h>)
#import <MyLibrary-Swift.h>
#else
#import <MyLibrary/MyLibrary-Swift.h>
#endif
To run custom code according to the presence of use_frameworks!
In your case you can use the __has_include(<MyLibrary-Swift.h>)
as a podfile DOESN'T contain use_frameworks!
like this:
#if defined __has_include && __has_include(<MyLibrary-Swift.h>)
// use_frameworks! is NOT present
#else
// use_frameworks! is present
#endif
Assuming that the generated header will look like this:
- MyLibrary-Swift.h -> if use_frameworks! is NOT present in the podfile
- MyLibrary/MyLibrary-Swift.h -> if use_frameworks! is present in the podfile