Skip to content

Commit 18bf4b4

Browse files
jaymaycryclaude
andcommitted
fix(ios): support use_frameworks! consumers via conditional Swift bridge import
CocoaPods exposes the generated `RNMotionTag-Swift.h` differently depending on host linkage. In default static-library mode (Expo, vanilla RN) it stays in DerivedSources and is only reachable as `"RNMotionTag-Swift.h"`. With `use_frameworks!` (commonly required by Firebase, MapBox, Sentry, and other Swift-only iOS SDKs) it lands inside the framework's Headers and is reachable as `<RNMotionTag/RNMotionTag-Swift.h>`. The previous quoted-only form produced `fatal error: 'RNMotionTag-Swift.h' file not found` for any `use_frameworks!` consumer. Using `__has_include` selects the right form at compile time so both linkage modes build with no host-side workaround. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2f359f4 commit 18bf4b4

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ The host's `Info.plist` must declare:
144144
- `FirebaseAppDelegateProxyEnabled = false` if the app uses Firebase,
145145
so its swizzling doesn't interfere with MotionTag's background URLSession.
146146

147+
Tested with both CocoaPods' default static-library linkage and
148+
`use_frameworks! :linkage => :static` (commonly enabled by Firebase,
149+
MapBox, and other Swift-only iOS SDKs) — no host-side workaround needed
150+
in either mode.
151+
147152
### Android — `Application.onCreate`
148153

149154
```kotlin

example/package-lock.json

Lines changed: 9 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ios/MotionTagModule.mm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@
55
// MotionTagDelegate (used as a protocol conformance on
66
// MotionTagDelegateImpl) is satisfied.
77
#import <MotionTagSDK/MotionTagSDK.h>
8+
// Swift generated header: CocoaPods only exposes it via the framework-style
9+
// include when the pod is built as a framework (use_frameworks!). In the
10+
// default static-library mode it stays in DerivedSources and is only
11+
// reachable via the quoted form.
12+
#if __has_include(<RNMotionTag/RNMotionTag-Swift.h>)
13+
#import <RNMotionTag/RNMotionTag-Swift.h>
14+
#else
815
#import "RNMotionTag-Swift.h"
16+
#endif
917
#import <RNMotionTagSpec/RNMotionTagSpec.h>
1018

1119
// Codegen protocol conformance lives here, not on the public @interface,

0 commit comments

Comments
 (0)