My team produces an SDK, and some of our clients consume the SDK as a SPM package. The SDK is in Objective-C, so we recommend to our clients to add -ObjC
to other linker flags.
We have a client who uses SPM who doesn't want to use -ObjC
, so we want to recommend using -force_load
instead. Is there a way I can access the file path of where the SPM package ends up, in such a way that I can use it with -force_load
? For example, it looks like the fetched package ends up at
/Users/<me>/Library/Developer/Xcode/DerivedData/FakeProject12-dyydlcfzdrhdvdchxphueqwmewfi/SourcePackages/checkouts/<package>/Sources/<SDK>.xcframework
Is there any way for me to access this path? Using $(DERIVED_DATA_DIR)
only gives me /Users/<me>/Library/Developer/Xcode/DerivedData/
. Is there way for me to get the path that I could use with -force_load
?
An alternative approach is to eliminate the need for -ObjC
(or -force_load
) all together by adding references to category files. See this example.