Sorry if this question has been asked before, I’m ...
# multiplatform
w
Sorry if this question has been asked before, I’m trying to configure export for a multiplatform framework in iOS, but it only seems to work if you specify
transitiveExport = true
This means though that the framework header is littered with unnneeded classes/dependencies. If I set transitiveExport to false then nothing is exported. Am I doing something wrong? See config below:
Copy code
kotlin {
    sourceSets {
        iosMain {
            dependencies {
                api 'org.beatkit.core:beatkit-core-model:1.0.0-SNAPSHOT'
                api 'org.beatkit.core:beatkit-core-plugin:1.0.0-SNAPSHOT'
                api 'org.beatkit:beatkit-foundation:1.0.0-SNAPSHOT'
                api 'com.beatgridmedia.measurementkit:measurementkit-model:1.0.0-SNAPSHOT'
                api 'com.beatgridmedia.measurementkit:measurementkit-module:1.0.0-SNAPSHOT'
                api 'com.beatgridmedia.measurementkit:measurementkit-viewmodel:1.0.0-SNAPSHOT'
                api 'com.beatgridmedia.measurementkit:measurementkit-app:1.0.0-SNAPSHOT'
            }
        }
    }

    def buildForDevice = System.getenv('SDK_NAME')?.startsWith("iphoneos")
    if (buildForDevice) {
        println("Building for device")
        iosArm64("ios") {
            binaries {
                framework()
            }
            compilations.all {
                kotlinOptions {
                    freeCompilerArgs += ["-Xobjc-generics"]
                }
            }
        }
    } else {
        println("Building for simulator")
        iosX64("ios") {
            binaries {
                framework()
            }
            compilations.all {
                kotlinOptions {
                    freeCompilerArgs += ["-Xobjc-generics"]
                }
            }
        }
    }

    kotlin.targets.ios.binaries.withType(org.jetbrains.kotlin.gradle.plugin.mpp.Framework) {
        export 'org.beatkit.core:beatkit-core-model:1.0.0-SNAPSHOT'
        export 'org.beatkit.core:beatkit-core-plugin:1.0.0-SNAPSHOT'
        export 'org.beatkit:beatkit-foundation:1.0.0-SNAPSHOT'
        export 'com.beatgridmedia.measurementkit:measurementkit-model:1.0.0-SNAPSHOT'
        export 'com.beatgridmedia.measurementkit:measurementkit-module:1.0.0-SNAPSHOT'
        export 'com.beatgridmedia.measurementkit:measurementkit-viewmodel:1.0.0-SNAPSHOT'
        export 'com.beatgridmedia.measurementkit:measurementkit-app:1.0.0-SNAPSHOT'
        transitiveExport = true
        isStatic = false
    }
}