I have built my framework (mixed Swift and Objective-C) and its dependencies (Alamofire) for macOS; no compiler errors arise. The build products happily resides in /Users/myuser/Library/Developer/Xcode/DerivedData/myproject-hash/Build/Products/Debug/
. The project was originally created as Cocoa Touch Framework; I added a macOS target manually (which took some wrangling).
Now I try to apply this answer, calling
swift -F /Users/myuser/Library/Developer/Xcode/DerivedData/myproject-hash/Build/Products/Debug/
When I try import Alamofire
, I get a whole slew of errors like this:
error: Alamofire debug map object file '/Users/myuser/Library/Developer/Xcode/DerivedData/myproject-hash/Build/Intermediates/Alamofire.build/Debug/Alamofire macOS.build/Objects-normal/x86_64/Timeline.o' has changed (actual time is 0x58ef7cfd, debug map time is 0x58ef6d81) since this executable was linked, file will be ignored
This is confusing since I just built the framework. Also, why is the framework linking into Intermediates
?
Finally:
error: Couldn't lookup symbols:
__swift_FORCE_LOAD_$_swiftCoreGraphics
__swift_FORCE_LOAD_$_swiftDispatch
This one also appears if I try import MyProject
after the (failed?) import Alamofire
.
If I directly import MyProject
(in a fresh session), all of the debug map object file...
errors happen, but not the lookup symbols
one. When I try to instantiate a struct from MyProject
, I do get the Couldn't lookup symbols
error, this time on symbols from MyProject
.
What is going on here? What am I doing wrong, and how can I fix or work around the issue?
When I use the release build, the errors are gone -- provided I do import Alamofire; import MyProject
. Apparently the dependencies are not imported recursively.