.swiftinterface includes imports to Foundation and Swift, and within custom framework dependencies, it adds related, for example import A. When I add the framework, compiler says 'No such module 'A'.
It inherits the search paths of the module that is importing it, so if your framework needs A as a dependency, your client needs to provide search paths to find A as well.
// swift-interface-format-version: 1.0
// swift-compiler-version: Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)
// swift-module-flags: -target x86_64-apple-ios13.2-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name FooFramework
import A
import Data
import Foundation
A is the dependency that is embedded in the FooFramework, when I embed it into any project, I get the error:
no such module 'A'
I need to specify in build Build Settings explicit path to inner dependency A of FooFramework or this is a bug?
Without a Modules directory, even with the correct search paths, the Swift compiler wouldn’t be able to load A.framework. Is it a binary framework you’ve gotten from someone else or one you’ve created yourself?
A also needs a .swiftinterface (or a .modulemap, if it’s an Objective-C framework) for Swift to be able to import it. Both of those live in the Modules directory
If I make directly from xcodebuild archive, archive file contains two frameworks, A and Foo. A has Headers and Modules folder as and Foo, but Foo also has Frameworks inside with duplication of A but with _CodeSignature, A and Info.plist.
Is A.framework a target in your project? I think Xcode (xcodebuild) archiving puts all the targets in the archive. So, you get an A.framework that can be used with any project, and a Foo.framework with A.framework embedded so you can use Foo.framework in any project.
Where does A.framework come from? How is it built? The A.framework embedded in Foo.framework can't be used standalone, but the A.framework in the archive can.
A – is just dylib with simple enum, it's attached as dependency with sign & embed to Foo.
In code, Foo.swift has import to A, and Foo.init prints some case of enum from A.
When I build Foo.framework, inside of its Frameworks there aren't included Headers and Modules of A, in this case compiler cannot link with libraries to run the framework completely, regarding error with dynamic linking.