KmpComposeUIViewControllerPlugin
Heavy lifts Gradle configurations when using KMP-ComposeUIViewController library.
Exposes the following tasks under the composeuiviewcontroller group:
copyFilesToXcode— syncs KSP-generated Swift Representables toiosApp/Representables/and updates the Xcode project references. Triggered automatically afterembedAndSignAppleFrameworkForXcode,embedSwiftExportForXcode, orsyncFrameworkwhen PluginParameters.autoExport istrue. Not registered when PluginParameters.experimentalSpmExport istrue.exportToSpm— experimental. Creates and maintains a local SPM package atiosApp/Representables/(folder names driven by PluginParameters.iosAppFolderName and PluginParameters.exportFolderName). Triggered automatically afterembedSwiftExportForXcodewhen PluginParameters.experimentalSpmExport istrue. Requires Swift Export to be configured.formatSwiftFiles— formats generated.swiftfiles withswiftformatdefault rules (if available).validateRepresentables— inspects the full Representables pipeline without triggering a build. Useful for diagnosing why Xcode cannot find generatedUIViewControllerRepresentablefiles. Run it with./gradlew validateRepresentables. ReportsOK,WARN, orFAILfor each check:
| Check | What it verifies | Fails when |
|---|---|---|
| KSP output | .swift files exist in build/generated/ksp/ | KSP never ran or failed mid-generation |
| Destination | .swift files exist in iosApp/Representables/ | copyFilesToXcode did not run |
| Sync | KSP output and destination contain the same files | Files are stale or missing |
| xcodeproj | All Representables are referenced in project.pbxproj | rebuild_file_references failed |
WARN entries (stale destination files, xcodeproj not found) do not fail the task. FAIL entries throw a GradleException listing all errors. The most common fix is ./gradlew clean. The xcodeproj check is skipped when PluginParameters.autoExport is false.