Search code examples
kotlin-multiplatform

How to make dependency project visible for Ios app?


I have a kotlin multiplatform project MusicFeature with targets for ios, android, common with the following build.gradle

sourceSets {
        commonMain {
            dependencies {
                implementation(project(":ProjectUtils"))
            }
        }
        androidMain {
        }

        iosMain {
            
        }
    }

ProjectUtils is also a multiplatform project.

There's no troubles in using ProjectUtils code from MusicFeature. But when I export MusicFeature as a framework for iOS, I don't have access to classes from ProjectUtils.


Solution

  • I guess you are looking for transitiveExport = true for your framework.

    binaries {
       framework {
           export project(':dependency')
           // Export transitively.
           transitiveExport = true
       }
    }
    

    You can find more reference here in export dependencies to binaries.