Modules that import other modules


I have another question: How do I create a module that, when imported, automatically imports other modules with it?

For example, when importing AppKit, there is no need to additionally import Foundation, because it's somehow just included.

Meanwhile, if I create two modules X and Y where Y depends on X, import Y doesn't allow me to import symbols of X. That makes sense, but is there a way to opt in to this behavior?

Best regards, V.

This can be done by writing @_exported import X in Y module. Note that _ indicates that this is not officially supported and may go away or change in future versions.

Thank you, I'll try that :slightly_smiling_face: