Why it happens
When you create a KMP project with Compose Multiplatform, the shared code (including the Compose UI) is compiled into an iOS framework (usually called shared.framework or something similar) that needs to be imported into your Xcode project.
If the Xcode project isn’t pointing to the right output folder or hasn’t built the framework yet, Swift will say:
No such module 'ComposeApp'
Steps to fix it
-
Ensure the iOS framework is built
-
In Android Studio (or via terminal), run:
./gradlew :shared:packForXcodeor if your module is named differently:
./gradlew :composeApp:syncFrameworkThis task generates the
.frameworkfile inshared/build/XCFrameworks.
-
-
Check your Xcode project setup
-
In your iOS app’s Xcode project, go to Frameworks, Libraries, and Embedded Content and make sure the generated
ComposeApp.xcframework(or whatever it’s named) is added. -
If it’s missing, drag it from the Gradle build output folder into Xcode.
-
-
Update the import path
-
In your Swift code, import it exactly as the framework is named — if the framework is
shared, you would use:import sharedIf your KMP project named it
ComposeApp, then:import ComposeApp
-
-
Re-sync Gradle and Xcode
-
Sometimes changes don’t reflect until you clean and rebuild:
./gradlew clean ./gradlew :shared:packForXcodeThen in Xcode: Product → Clean Build Folder and rebuild.
-
-
Match the iOS target
-
Make sure the Gradle build is creating the framework for the same architecture your simulator or device uses (
arm64for devices,x86_64for Intel simulators,arm64for Apple Silicon simulators). -
If you run into architecture mismatches, you can specify:
./gradlew :shared:packForXcode -Pkotlin.native.cocoapods.target=iosSimulatorArm64
-