My Swift/Obj-C hybrid project is setup with two targets:
MyProject
and MyProjectTests
In order to write unit tests (using XCTest
), I have the following configurations for the main target (MyProject
) build settings:
Enable testability = Yes
Defines module = Yes
This works fine, but I would like to know what is actually going on when I specify Defines module = Yes
.
Does specifying Defines module = Yes
mean:
DerivedData
?Defines Module = Yes
flag does nothing filesystem-wise, but still allows the main project target to be imported as a (testable) module in a test target?Making app work with both Swift and Objective-C, can be a delicate process. You must adopt modules if you want a hybrid project. When bringing old Objective-C code to a Swift project, this means setting the “Defines Module” (DEFINES_MODULE
) build setting to YES
in the framework target. This instructs Xcode to install a module.modulemap
file (and possibly a module.private.modulemap
) alongside the headers in the framework. Objective-C frameworks need to define a module to be used by Swift.
Source: Big Nerd Ranch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With