What build setting or flag creates "@_exported import MyModule" in .swiftinterface and how can I not add that?

Hi,

I am building a static lib "MyModule", then package it to xcframework suing -create-framework

my build script

  xcodebuild build \
  -workspace MyWorkSpace.xcworkspace \
  -scheme MyModule \
  -derivedDataPath derived_data \
  -arch x86_64 \
  -sdk iphonesimulator \
  BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
  SKIP_INSTALL=NO \
  SWIFT_INSTALL_OBJC_HEADER=NO`

how ever when downstream project uses this xcframework, it gets error

/xxx/MyModule.swiftmodule/x86_64-apple-ios-simulator.swiftinterface:5:19: Underlying Objective-C module 'MyModule' not found

/xxx/ViewController.swift:9:8: Failed to build module 'MyModule' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug

when looking at the .swiftinterface file, line 5 is like this

@_exported import MyModule

either I remove @_exported or I remove the whole line all together then my downstream project compiles fine.

what build flag or build setting I can set so that I don't have to manually remove this line? it is strange the .swiftinterface file of MyModule needs to import itself in the .swiftinterface file.

Also the xcworkspace is created by Cocoapods. I am not sure whether this might be related.

Terms of Service

Privacy Policy

Cookie Policy