compose가 릴리즈되고, 멀티 플렛폼(Android, ios, 윈도우 앱, 홈페이지)서도 fork of compose를 지원해준다고 한다.
JetPack Compose에서 fork of compose를 하기 위해서는 아래와 같이 설정을 해주어야 한다.
KMP 마이그레이션 및 컴포즈 설정
안드로이드에서 kotlin multiplatform와 호환하기 위해서 build.gradle.kt에서 추가/수정을 해야한다.
// app 수준 build.gradle.kt
plugins {
id("com.android.application")
// or
id("com.android.library")
// Replace `kotlin("android")` with:
kotlin("multiplatform")
id("org.jetbrains.compose")
}
// Declare android target
kotlin {
androidTarget()
}
android {
// Your android app configuration
// Enabling Compose
buildFeatures {
compose = true
}
// Defining Compose version
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get()
}
}
// project build.gradle.kt
kotlin {
androidTarget {
compilations.all {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
sourceSets {
commonMain.dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.ui)
implementation(compose.animation)
}
}
}
android {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
plugins {
kotlin("multiplatform") version "1.9.23" apply false
id("org.jetbrains.compose") version "1.6.1" apply false
}
출처
touchlab-lab/compose-animations (github.com)
GitHub - touchlab-lab/compose-animations
Contribute to touchlab-lab/compose-animations development by creating an account on GitHub.
github.com
Jetpack Compose에서 Compose 멀티플랫폼으로: 전환 가이드 — Touchlab
Jetpack Compose to Compose Multiplatform: Transition Guide
As an Android developer, you probably already use Jetpack Compose to build UI. But did you know that with a few changes you can also build your application for other platforms, such as iOS, macO...
touchlab.co
'안드로이드 > 잡다한 지식' 카테고리의 다른 글
[안드로이드] WorkManager와 Koin (0) | 2024.05.16 |
---|---|
[안드로이드] 휴대폰 원격 공유를 개발하면서 생겼던 고민들 정리 (0) | 2024.05.07 |
[안드로이드] Rxjava + retrofit2 연결 도중 취소하기 (0) | 2023.12.26 |
[안드로이드] 원격 터치 기능 정리 (0) | 2023.11.06 |
[안드로이드] MQTT 라이브러리 정리 (0) | 2023.10.26 |