I have three targets - application and two static libraries (Lets call them as App target, LibA and LibA targets for easy references).
The App target is dependent on the LibA target and LibA target is dependent on LibB target.
In the source files in LibA target, I just
import LibB
to use the types in LibB.
Now, unfortunately, there is a need to use a method from LibA in LibB. This goes against the dependency order.
In C++, you can leave a global function declaration (extern) in LibB and expect it to be defined somewhere else (LibA here). I can just invoke that global function in LibB. The linker will find the function definition in LibA when constructing the executable (by building the App target). This also ensures the compilation of LibA and LibB. The same can be achieved for types using forward declarations of classes.
Is something like this possible in swift? Is there any way to expose a method from LibA to LibB without LibB importing LibA (importing causes a cyclic dependency error) ?
(I understand that I haven't segregated the modules properly, but wanted to know if something like this is possible in swift (since swift is also a compiled language like C++)).