What's the guidance when exporting multiple Gradle...
# swift-export
m
What's the guidance when exporting multiple Gradle projects from an umbrella module with Swift Export? The official docs mention a
moduleName
and
flattenPackage
that can be set when exporting modules. Are those a must? I've tried the following with Kotlin 2.4.0 - the Gradle Kotlin DSL compiles, but the exported umbrella module does not contain the exported types from the other modules:
Copy code
swiftExport {
        moduleName = "Shared"
        flattenPackage = "com.example.sandbox"

        // is this possible?
        export(project(":featureA"))
        export(project(":featureB"))
        export(project(":featureC"))

        // ...
    }
I also tried this, but it seems the functions from the other modules do not get exported:
Copy code
sourceSets {
        commonMain {
            dependencies {
                api(project(":featureA"))
                api(project(":featureB"))
                api(project(":featureC"))
a
Hello there 🙂 Thanks for the report!
The official docs mention a
moduleName
and
flattenPackage
that can be set when exporting modules. Are those a must?
No, there is no required fields for Swift Export. One can even omit the
swiftExport
block entirely - all the names for modules would be calculated from the maven coordinates of a project(or from local name).
I've tried the following with Kotlin 2.4.0 - the Gradle Kotlin DSL compiles, but the exported umbrella module does not contain the exported types from the other modules
I assume that the problem is that you are looking for the declarations under
exported umbrella module
? If you take a look at our sample with the setup you desire - you can see that with swift export one has to import each of those modules separately. Swift Export keeps the original module separation. IIRC,
:featureC
would have
FeatureC
as a result of automatic conversion.
👀 1
m
Thanks, I'll soon check out the resources you sent! Let's see how we can get it working.
Having multiple Swift modules is very welcome, importing just the parts we need is great!
g
Take a look here too, a multi module project using swift export: https://github.com/GuilhE/Magic hope it helps 😊 (it uses koin too and it only exposes what's needed for iOS, interfaces)
kodee happy 1