This is a Kotlin Multiplatform project targeting Android, iOS.
/composeApp is for code that will be shared across your Compose Multiplatform applications.
It contains several subfolders:
/iosApp contains iOS applications. Even if you’re sharing your UI with Compose Multiplatform,
you need this entry point for your iOS app. This is also where you should add SwiftUI code for your project.
/shared is for the code that will be shared between all targets in the project.
The most important subfolder is commonMain. If preferred, you
can add code to the platform-specific folders here too.
To build and run the development version of the Android app, use the run configuration from the run widget
in your IDE’s toolbar or build it directly from the terminal:
./gradlew :composeApp:assembleDebug
.\gradlew.bat :composeApp:assembleDebug
To build and run the development version of the iOS app, use the run configuration from the run widget
in your IDE’s toolbar or open the /iosApp directory in Xcode and run it from there.
This project includes a Server-Sent Events (SSE) sample implementation using Ktor Client.
You need to run an SSE server on http://localhost:8080/sse for testing.
Example SSE server response format:
data: {"message": "Hello from server"}
id: 1
event: update
data: {"message": "Update message"}
undefinedAndroid:undefined
./gradlew :composeApp:assembleDebug
undefinediOS:undefined
Open iosApp directory in Xcode and run.
SseClient.kt: Main SSE client implementationConnectionState.kt: Connection state definitionsSseEvent.kt: Event data modelSseScreen.kt: Android UI screenContentView.swift: iOS UI screenLearn more about Kotlin Multiplatform…
We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.