I have an old project Objective-C iOS app I've been updating to Swift. It used to use Carthage, but now uses only SPM for dependencies. One such dependency is TrueTime (which was updated to support SPM by that author).
It has two products, TrueTime
, a Swift library, and CTrueTime
a header-only C library with some packed, byte-aligned structs used when parsing NTP responses.
I’m adding unit tests to my project, and when I import the app module with @testable import MyApp
, the build fails on that line with
@testable import MyApp
^
<unknown>:0: error: missing required module 'CTrueTime'
The app itself builds and runs just fine.
If I don’t import the app, then I have to expressly add code I want to test to the test target, which is not the right way to do these things. The other dependencies I have all work fine, but none have a C library product.
I get a warning about implicitly including a bridging header, but I don’t think that has anything to do with this.
Update: I also just tried adding TrueTime to a modern, pure SwiftUI iOS app, and I get the same issue.
Is there something more I need to add to my test target config?
(I've also posted this to stack overflow https://stackoverflow.com/questions/76284838/when-importing-app-with-testable-get-missing-required-module-ctruetime-usi)