Skip to content

Commit e085ddd

Browse files
committed
fix(functions): make swift/objective-c interop work in non-use_frameworks! case
the new pre-built react-native core for iOS is not built with use_frameworks, so header imports that assume a module is in a framework (that is, angle-bracket imports) do not resolve in that case we can fall back on a direct header path import, which works via cocoapods adding the build header path where the Swift interop file goes to the build search path
1 parent 58eb2ee commit e085ddd

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

packages/functions/ios/RNFBFunctions/RNFBFunctionsModule.mm

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,24 @@
1818
#import <Firebase/Firebase.h>
1919
#import <React/RCTUtils.h>
2020

21-
#import <RNFBFunctions/RNFBFunctions-Swift.h>
2221
#import "NativeRNFBTurboFunctions.h"
2322
#import "RNFBApp/RCTConvert+FIRApp.h"
2423
#import "RNFBApp/RNFBRCTEventEmitter.h"
2524
#import "RNFBApp/RNFBSharedUtils.h"
2625
#import "RNFBFunctionsModule.h"
2726

27+
#if __has_include(<RNFBFunctions/RNFBFunctions-Swift.h>)
28+
// This import will work in situations where `use_frameworks!` is in use
29+
#import <RNFBFunctions/RNFBFunctions-Swift.h>
30+
#elif __has_include("RNFBFunctions-Swift.h")
31+
// If `use_frameworks!` is not in use (for example, while using pre-built
32+
// react-native core) then header imports based on frameworks assumptions fail.
33+
// So, if frameworks are not available, fall back to importing the header directly, it
34+
// should be findable from a header search path pointing to the build
35+
// directory. See firebase-ios-sdk#12611 for more context.
36+
#import "RNFBFunctions-Swift.h"
37+
#endif
38+
2839
static __strong NSMutableDictionary *streamListeners;
2940

3041
@implementation RNFBFunctionsModule

0 commit comments

Comments
 (0)