Let's say I have an SPM package I've created called PkgA, this package has an external dependency on another SPM package called PkgB, and that there is an app that depends on PkgA.
What I would like is to import PkgA in the app and be able to immediately use content of PkgB in the app, in the same way importing UIKit imports UIViewController, UIView, etc. That is to say, I want PkgA to be analogous to UIKit (so it should really be more like KitA than PkgA).
The issue I'm facing is that it's not behaving in this manner. I'd like to think that if the PkgA target compiles PkgA.swift and the file contains an 'import PkgB', that the library would automatically include PkgB. What's weird is that I get a message like "Cannot find 'ClassB' in scope", in the app but when I hold the command button, select 'ClassB' and press "Jump to Definition", Xcode immediately goes to the declaration. So Xcode does know exactly where it is, despite the error message.
One workaround I have found is adding the following to PkgA.swift:
// PkgA.swift
import PkgB
// typealias is required for app to find ClassB
public typealias ClassB = PkgB.ClassB
This would allow me to get the following to work in my app:
// App
import PkgA
let foo = ClassB()
It is certainly a poor workaround because I can no longer rely on using the Option button to quickly see documentation of ClassB. It overall seems pretty hacky...
Now, I can certainly get around everything by just importing PkgB:
// App
import PkgB
let foo = ClassB()
However, I plan on adding tons of dependencies and I don't like the idea of having lots of imports (in the same way users are not importing UIViewController, UISearchBar, UIAccessibility, etc). I essentially want PkgA to act like a kit, and I'm unfortunately hit a wall with this. I even attended a lab for WWDC2021 and the person I was with was completely stumped.
Anyone have any idea what I could possibly be missing? I've been stumped for weeks :(