Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support use_frameworks in Swift example #15

Open
louiszawadzki opened this issue Jul 17, 2023 · 0 comments
Open

Support use_frameworks in Swift example #15

louiszawadzki opened this issue Jul 17, 2023 · 0 comments

Comments

@louiszawadzki
Copy link

Hi!

The Swift example as it is does not support apps using use_frameworks! in their Podfile.
When using frameworks, the Swift import is different.

Instead of:

#import "ProductModuleName-Swift.h"

It should be:

#import <ProductName/ProductModuleName-Swift.h>

So users with use_frameworks! will get an error at build stating that:

fatal error: 'ProductModuleName-Swift.h' file not found

To handle both cases from inside the library, we can use #if __has_include as recommended on this Cocoapods issue.
I'd recommend changing the import in calculator/ios/RNCalculator.mm to be (not tested):

#if __has_include("calculator-Swift.h")
#import <calculator-Swift.h>
#else
#import <calculator/calculator-Swift.h>
#endif

For reference, here is the link to the change we ended up making.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant