Bradleycorn
04/19/2023, 7:25 PMapi()
dependency (and is exported in the cocoapods configuration)?russhwolf
04/19/2023, 7:37 PMBradleycorn
04/19/2023, 7:42 PMrusshwolf
04/19/2023, 7:42 PMBradleycorn
04/19/2023, 7:43 PMallShared
module has a dependency on another module called adw-program
.
adw-program
defines a class, called Program
.
allShared
defines a class called IosContainer
.
IosContainer
has a function, getProgram()
that returns an instance of Program
.
in my allShared
module, if i use implementation
for the adw-program
dependency, and don’t export it via the cocoapods framework, then in my swift code, the Program
class’s type is actually Adw_programProgram
… Also, any of the other classes in my adw-program
module are NOT available at all in my ios/swift project. the Adw_programProgram
class is available only because the IosContainer
has a method that returns an instance of it.
However, if I make the adw-program
an api()
dependency (and export it via cocoapods), then things in Swift are more “what you would expect”. I have a Program
class, and I can see all of the (public) classes declared in adw-program
.russhwolf
04/19/2023, 8:55 PMadw-program
into two separate modules. One has just the public API that you'll expose through allShared
and the other has impls and internal details. Then you can export the API module but still control what gets exported based on whether it's in the api or the impl module, and you won't see the module name prefix on things from the api module.Bradleycorn
04/19/2023, 9:00 PMadw-program
exposes my “Repository”, and there are additional modules for adw-network
, adw-storage
, etc that have the ktor and sqldelight stuff. I also have adw-models
that contains all of the models (data classes), so that one I definitely want to use api exports for.adw-program
and adw-models
being exported api’s, and all the others being implementations that are kept “internal” to the library