Closed kalub92 closed 1 day ago
@kalub92 So everything works fine when using import BrazeUI
in Swift code, I assume.
Just that it doesn't work when using a Swift pkg module in Objective-C code, rite?
Actually, you were right about the modulemap in OTHER_CFLAGS.
I think I need more time to make the fix this way because in some cases, Xcode does not dump the modulemap in GENERATED_MODULEMAP_DIR
.
In the meantime, may I suggest adding ${GENERATED_MODULEMAP_DIR}
to header search path so that those "<module>-Swift.h"
are recognized. Then you can import the module with #import "<module>-Swift.h"
.
Hi @trinhngocthuyen, yes that's right that it works for Swift but not Obj-C. I was able to make a workaround for my use case, but any update on this on a plug-in level?
Sorry for the late update. The support for SPM package imports in ObjC has been done in #127. Kindly help check it out with the latest on main. Thank you!
What happened?
When adding Braze and several other Segment dependencies to my project, I can import then in a
.swift
file with no issue, but when attempting to import them in an.m
file, I see an error:Module 'BrazeUI' not found
I see this same issue for
SegmentBraze
andSegmentBrazeUI
as well.I tinkered around with the
.xcconfig
and found that by adding the following lines toOTHER_CFLAGS
I am able to successfully import those modules in Objective-C files as well (although I need to do this manually):-fmodule-map-file="${GENERATED_MODULEMAP_DIR}/BrazeUI.modulemap"
-fmodule-map-file="${GENERATED_MODULEMAP_DIR}/SegmentBraze.modulemap"
-fmodule-map-file="${GENERATED_MODULEMAP_DIR}/SegmentBrazeUI.modulemap"
I've been able to reproduce this behavior in the example project on my fork: https://github.com/kalub92/cocoapods-spm/tree/kalub92%2Fbraze-modulemap-issue
CocoaPods environment
Stack
Installation Source
Plugins
Podfile
Anything else?
No response