├── .gitignore ├── LICENSE ├── README.md ├── build.gradle.kts ├── composeApp ├── build.gradle.kts └── src │ ├── androidMain │ ├── AndroidManifest.xml │ ├── kotlin │ │ └── dev │ │ │ └── sunnat629 │ │ │ └── MainActivity.kt │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ └── strings.xml │ ├── commonMain │ ├── composeResources │ │ └── drawable │ │ │ ├── compose-multiplatform.xml │ │ │ ├── ic_fan.xml │ │ │ └── ic_sunrise.xml │ └── kotlin │ │ └── dev │ │ └── sunnat629 │ │ ├── App.kt │ │ ├── DayCircleUI.kt │ │ ├── FanRotation.kt │ │ └── SpiralAnimationUI.kt │ ├── desktopMain │ └── kotlin │ │ └── dev │ │ └── sunnat629 │ │ └── main.kt │ ├── iosMain │ └── kotlin │ │ └── dev │ │ └── sunnat629 │ │ └── MainViewController.kt │ └── wasmJsMain │ ├── kotlin │ └── dev │ │ └── sunnat629 │ │ └── main.kt │ └── resources │ ├── index.html │ └── styles.css ├── gradle.properties ├── gradle ├── libs.versions.toml └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── iosApp ├── Configuration │ └── Config.xcconfig ├── iosApp.xcodeproj │ └── project.pbxproj └── iosApp │ ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ └── app-icon-1024.png │ └── Contents.json │ ├── ContentView.swift │ ├── Info.plist │ ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json │ └── iOSApp.swift ├── kotlin-js-store └── yarn.lock ├── server ├── build.gradle.kts └── src │ └── main │ ├── kotlin │ └── dev │ │ └── sunnat629 │ │ └── Application.kt │ └── resources │ └── logback.xml ├── settings.gradle.kts └── shared ├── build.gradle.kts └── src ├── androidMain └── kotlin │ └── dev │ └── sunnat629 │ └── Platform.android.kt ├── commonMain └── kotlin │ └── dev │ └── sunnat629 │ ├── Constants.kt │ ├── Greeting.kt │ └── Platform.kt ├── iosMain └── kotlin │ └── dev │ └── sunnat629 │ └── Platform.ios.kt ├── jvmMain └── kotlin │ └── dev │ └── sunnat629 │ └── Platform.jvm.kt └── wasmJsMain └── kotlin └── dev └── sunnat629 └── Platform.wasmJs.kt /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .kotlin 3 | .gradle 4 | **/build/ 5 | xcuserdata 6 | !src/**/build/ 7 | local.properties 8 | .idea 9 | .fleet 10 | .DS_Store 11 | captures 12 | .externalNativeBuild 13 | .cxx 14 | *.xcodeproj/* 15 | !*.xcodeproj/project.pbxproj 16 | !*.xcodeproj/xcshareddata/ 17 | !*.xcodeproj/project.xcworkspace/ 18 | !*.xcworkspace/contents.xcworkspacedata 19 | **/xcshareddata/WorkspaceSettings.xcsettings 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 S M Mohi Us Sunnat 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Compose Multiplatform Portfolio UI 2 | 3 | This project is a **Kotlin Multiplatform (KMP)** application featuring a Compose-based UI for a sleek and modern portfolio page. The design is responsive, minimal, and user-friendly, suitable for showcasing personal projects, skills, and social links. 4 | 5 | ## Features 6 | - **Compose UI**: Leverages Jetpack Compose for declarative UI development. 7 | - **Kotlin Multiplatform**: Runs on multiple platforms (Android, Desktop, iOS in the future). 8 | - **Modern Design**: Inspired by minimal UI/UX design patterns. 9 | - **Responsive Layout**: Adaptive to different screen sizes. 10 | - **Theming**: Light and dark mode support with customizable colors. 11 | - **Interactive Components**: Includes buttons, icons, and dynamic sections. 12 | 13 | ## Screenshots 14 | _TBA_ 15 | 16 | ## Getting Started 17 | 18 | ### Prerequisites 19 | - **Kotlin 1.9+** 20 | - **Android Studio Giraffe or newer** 21 | - **Compose Multiplatform plugin** 22 | - Gradle 8.0+ 23 | 24 | ## Contributing 25 | Contributions are welcome! Feel free to open an issue or submit a pull request. 26 | 27 | ## License 28 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. 29 | 30 | -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | // this is necessary to avoid the plugins to be loaded multiple times 3 | // in each subproject's classloader 4 | alias(libs.plugins.androidApplication) apply false 5 | alias(libs.plugins.androidLibrary) apply false 6 | alias(libs.plugins.composeMultiplatform) apply false 7 | alias(libs.plugins.composeCompiler) apply false 8 | alias(libs.plugins.kotlinJvm) apply false 9 | alias(libs.plugins.kotlinMultiplatform) apply false 10 | alias(libs.plugins.ksp) apply false 11 | alias(libs.plugins.kotlinx.serialization) apply false 12 | alias(libs.plugins.buildConfig) apply false 13 | } -------------------------------------------------------------------------------- /composeApp/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.jetbrains.compose.desktop.application.dsl.TargetFormat 2 | import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl 3 | import org.jetbrains.kotlin.gradle.dsl.JvmTarget 4 | import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig 5 | 6 | plugins { 7 | alias(libs.plugins.kotlinMultiplatform) 8 | alias(libs.plugins.androidApplication) 9 | alias(libs.plugins.composeMultiplatform) 10 | alias(libs.plugins.composeCompiler) 11 | alias(libs.plugins.ksp) 12 | alias(libs.plugins.kotlinx.serialization) 13 | alias(libs.plugins.buildConfig) 14 | } 15 | 16 | kotlin { 17 | androidTarget { 18 | compilerOptions { 19 | jvmTarget.set(JvmTarget.JVM_11) 20 | } 21 | } 22 | 23 | listOf( 24 | iosX64(), 25 | iosArm64(), 26 | iosSimulatorArm64() 27 | ).forEach { iosTarget -> 28 | iosTarget.binaries.framework { 29 | baseName = "ComposeApp" 30 | isStatic = true 31 | } 32 | } 33 | 34 | jvm("desktop") 35 | 36 | @OptIn(ExperimentalWasmDsl::class) 37 | wasmJs { 38 | moduleName = "composeApp" 39 | browser { 40 | val rootDirPath = project.rootDir.path 41 | val projectDirPath = project.projectDir.path 42 | commonWebpackConfig { 43 | outputFileName = "composeApp.js" 44 | devServer = (devServer ?: KotlinWebpackConfig.DevServer()).apply { 45 | static = (static ?: mutableListOf()).apply { 46 | // Serve sources to debug inside browser 47 | add(rootDirPath) 48 | add(projectDirPath) 49 | } 50 | } 51 | } 52 | } 53 | binaries.executable() 54 | } 55 | 56 | sourceSets { 57 | val desktopMain by getting 58 | 59 | androidMain.dependencies { 60 | implementation(compose.preview) 61 | implementation(libs.androidx.activity.compose) 62 | } 63 | commonMain.dependencies { 64 | implementation(compose.runtime) 65 | implementation(compose.foundation) 66 | implementation(compose.material) 67 | implementation(compose.materialIconsExtended) 68 | implementation(compose.material3) 69 | implementation(compose.ui) 70 | implementation(compose.components.resources) 71 | implementation(compose.components.uiToolingPreview) 72 | implementation(libs.androidx.lifecycle.viewmodel) 73 | implementation(libs.androidx.lifecycle.runtime.compose) 74 | // 75 | // implementation(libs.compose.navigation) 76 | implementation(libs.kotlinx.coroutines.core) 77 | implementation(libs.kotlinx.serialization.json) 78 | // 79 | implementation(libs.coil) 80 | implementation(libs.kotlinx.datetime) 81 | 82 | implementation(projects.shared) 83 | // implementation("org.jetbrains.skiko:skiko-wasm-js:0.8.18") 84 | } 85 | desktopMain.dependencies { 86 | implementation(compose.desktop.currentOs) 87 | implementation(libs.kotlinx.coroutines.swing) 88 | } 89 | } 90 | } 91 | 92 | android { 93 | namespace = "dev.sunnat629" 94 | compileSdk = libs.versions.android.compileSdk.get().toInt() 95 | 96 | defaultConfig { 97 | applicationId = "dev.sunnat629" 98 | minSdk = libs.versions.android.minSdk.get().toInt() 99 | targetSdk = libs.versions.android.targetSdk.get().toInt() 100 | versionCode = 1 101 | versionName = "1.0" 102 | } 103 | packaging { 104 | resources { 105 | excludes += "/META-INF/{AL2.0,LGPL2.1}" 106 | } 107 | } 108 | buildTypes { 109 | getByName("release") { 110 | isMinifyEnabled = false 111 | } 112 | } 113 | compileOptions { 114 | sourceCompatibility = JavaVersion.VERSION_11 115 | targetCompatibility = JavaVersion.VERSION_11 116 | } 117 | } 118 | 119 | dependencies { 120 | debugImplementation(compose.uiTooling) 121 | } 122 | 123 | compose.desktop { 124 | application { 125 | mainClass = "dev.sunnat629.MainKt" 126 | 127 | nativeDistributions { 128 | targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) 129 | packageName = "dev.sunnat629" 130 | packageVersion = "1.0.0" 131 | } 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /composeApp/src/androidMain/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /composeApp/src/androidMain/kotlin/dev/sunnat629/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package dev.sunnat629 2 | 3 | import android.os.Bundle 4 | import androidx.activity.ComponentActivity 5 | import androidx.activity.compose.setContent 6 | import androidx.compose.runtime.Composable 7 | import androidx.compose.ui.tooling.preview.Preview 8 | 9 | class MainActivity : ComponentActivity() { 10 | override fun onCreate(savedInstanceState: Bundle?) { 11 | super.onCreate(savedInstanceState) 12 | 13 | setContent { 14 | App() 15 | } 16 | } 17 | } 18 | 19 | @Preview 20 | @Composable 21 | fun AppAndroidPreview() { 22 | App() 23 | } -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunnat629/ComposeProject/7c98d119b9a700c5989f1929eff898bfb8cde8cb/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunnat629/ComposeProject/7c98d119b9a700c5989f1929eff898bfb8cde8cb/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunnat629/ComposeProject/7c98d119b9a700c5989f1929eff898bfb8cde8cb/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunnat629/ComposeProject/7c98d119b9a700c5989f1929eff898bfb8cde8cb/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunnat629/ComposeProject/7c98d119b9a700c5989f1929eff898bfb8cde8cb/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunnat629/ComposeProject/7c98d119b9a700c5989f1929eff898bfb8cde8cb/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunnat629/ComposeProject/7c98d119b9a700c5989f1929eff898bfb8cde8cb/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunnat629/ComposeProject/7c98d119b9a700c5989f1929eff898bfb8cde8cb/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunnat629/ComposeProject/7c98d119b9a700c5989f1929eff898bfb8cde8cb/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunnat629/ComposeProject/7c98d119b9a700c5989f1929eff898bfb8cde8cb/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /composeApp/src/androidMain/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ComposeProject 3 | -------------------------------------------------------------------------------- /composeApp/src/commonMain/composeResources/drawable/compose-multiplatform.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 14 | 18 | 24 | 30 | 36 | -------------------------------------------------------------------------------- /composeApp/src/commonMain/composeResources/drawable/ic_fan.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /composeApp/src/commonMain/composeResources/drawable/ic_sunrise.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/dev/sunnat629/App.kt: -------------------------------------------------------------------------------- 1 | package dev.sunnat629 2 | 3 | import androidx.compose.foundation.background 4 | import androidx.compose.foundation.layout.Box 5 | import androidx.compose.foundation.layout.fillMaxSize 6 | import androidx.compose.material3.MaterialTheme 7 | import androidx.compose.runtime.Composable 8 | import androidx.compose.ui.Alignment 9 | import androidx.compose.ui.Modifier 10 | import androidx.compose.ui.graphics.Color 11 | import org.jetbrains.compose.ui.tooling.preview.Preview 12 | 13 | @Composable 14 | @Preview 15 | fun App() { 16 | MaterialTheme { 17 | Box( 18 | modifier = Modifier.fillMaxSize().background(Color.Black), 19 | contentAlignment = Alignment.Center 20 | ) { 21 | // Soon, I will add Home... 22 | // SunriseNSunsetUI() 23 | SpiralAnimationView() 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/dev/sunnat629/DayCircleUI.kt: -------------------------------------------------------------------------------- 1 | /** 2 | * Inspired by shttps://dribbble.com/shots/2867210-Sunset-sunrise-widget-animation 3 | **/ 4 | 5 | import androidx.compose.foundation.Canvas 6 | import androidx.compose.foundation.background 7 | import androidx.compose.foundation.layout.* 8 | import androidx.compose.material.icons.Icons 9 | import androidx.compose.material.icons.filled.Nightlight 10 | import androidx.compose.material.icons.filled.WbSunny 11 | import androidx.compose.material.icons.filled.WbTwilight 12 | import androidx.compose.material3.Icon 13 | import androidx.compose.material3.MaterialTheme 14 | import androidx.compose.material3.Text 15 | import androidx.compose.runtime.Composable 16 | import androidx.compose.runtime.LaunchedEffect 17 | import androidx.compose.runtime.mutableStateOf 18 | import androidx.compose.runtime.remember 19 | import androidx.compose.ui.Alignment 20 | import androidx.compose.ui.Modifier 21 | import androidx.compose.ui.geometry.Offset 22 | import androidx.compose.ui.geometry.Size 23 | import androidx.compose.ui.graphics.Color 24 | import androidx.compose.ui.graphics.drawscope.Stroke 25 | import androidx.compose.ui.graphics.drawscope.translate 26 | import androidx.compose.ui.graphics.vector.rememberVectorPainter 27 | import androidx.compose.ui.unit.dp 28 | import androidx.compose.ui.unit.sp 29 | import composeproject.composeapp.generated.resources.Res 30 | import composeproject.composeapp.generated.resources.ic_sunrise 31 | import dev.sunnat629.Greeting 32 | import kotlinx.coroutines.delay 33 | import kotlinx.datetime.LocalTime 34 | import org.jetbrains.compose.resources.painterResource 35 | import org.jetbrains.compose.ui.tooling.preview.Preview 36 | import kotlin.math.PI 37 | import kotlin.math.cos 38 | import kotlin.math.sin 39 | 40 | @Composable 41 | fun SunriseNSunsetUI() { 42 | Column { 43 | val greeting = remember { Greeting().greet() } 44 | Text("Compose: $greeting") 45 | 46 | Box( 47 | modifier = Modifier.fillMaxSize().background(Color.LightGray.copy(alpha = 0.3f)), 48 | contentAlignment = Alignment.Center 49 | ) { 50 | CircularSunriseSunset() 51 | } 52 | } 53 | } 54 | 55 | @Composable 56 | fun CircularSunriseSunset() { 57 | val sunrise = LocalTime(hour = 7, minute = 30) 58 | val sunset = LocalTime(hour = 16, minute = 0) 59 | val currentTime = remember { mutableStateOf(LocalTime(hour = 14, minute = 30, second = 0)) } 60 | 61 | val dayColor = remember { Color(0xFFFFA726) } 62 | val nightColor = remember { Color(0xFF90CAF9) } 63 | 64 | // 65 | // LaunchedEffect(Unit) { 66 | // while (true) { 67 | // delay(10L) 68 | // val newMinute = (currentTime.value.minute + 1) % 60 69 | // val newHour = (currentTime.value.hour + (if (newMinute == 0) 1 else 0)) % 24 70 | // currentTime.value = LocalTime(hour = newHour, minute = newMinute, second = 0) 71 | // } 72 | // } 73 | 74 | // val currentTime = remember { mutableStateOf(Clock.System.now().toLocalDateTime(TimeZone.currentSystemDefault()).time) } 75 | 76 | LaunchedEffect(Unit) { 77 | while (true) { 78 | delay(10L) 79 | val newMinute = (currentTime.value.minute + 1) % 60 80 | val newHour = (currentTime.value.hour + (if (newMinute == 0) 1 else 0)) % 24 81 | currentTime.value = LocalTime(hour = newHour, minute = newMinute, second = 0) 82 | // currentTime.value = Clock.System.now().toLocalDateTime(TimeZone.currentSystemDefault()).time 83 | } 84 | } 85 | 86 | val sunriseMinutes = sunrise.hour * 60 + sunrise.minute 87 | val sunsetMinutes = sunset.hour * 60 + sunset.minute 88 | val currentMinutes = currentTime.value.hour * 60 + currentTime.value.minute 89 | 90 | val dayDuration = sunsetMinutes - sunriseMinutes 91 | val nightDuration = (24 * 60) - dayDuration 92 | 93 | val progress = when { 94 | currentMinutes in sunriseMinutes until sunsetMinutes -> (currentMinutes - sunriseMinutes) / dayDuration.toFloat() 95 | currentMinutes < sunriseMinutes -> (currentMinutes + (24 * 60) - sunsetMinutes) / nightDuration.toFloat() 96 | else -> (currentMinutes - sunsetMinutes) / nightDuration.toFloat() 97 | } 98 | 99 | val isDay = currentMinutes in sunriseMinutes until sunsetMinutes 100 | val painter = rememberVectorPainter(if (isDay) Icons.Default.WbSunny else Icons.Default.Nightlight) 101 | 102 | Box(contentAlignment = Alignment.Center) { 103 | Canvas(modifier = Modifier.size(300.dp)) { 104 | 105 | drawCircle( 106 | color = Color.LightGray.copy(alpha = 0.3f), 107 | radius = size.minDimension / 2 108 | ) 109 | 110 | val radius = size.minDimension / 2 111 | val centerOffset = Offset(size.width / 2, size.height / 2) 112 | 113 | val sweepAngle = progress * 180 114 | val startAngle = if (isDay) 180f - sweepAngle else sweepAngle 115 | 116 | val radian = if (isDay) (-startAngle) * (PI / 180).toFloat() else (startAngle) * (PI / 180).toFloat() 117 | val iconOffset = Offset( 118 | x = centerOffset.x + radius * cos(radian), 119 | y = centerOffset.y + radius * sin(radian) 120 | ) 121 | 122 | drawArc( 123 | color = Color.DarkGray.copy(alpha = 0.4f), 124 | startAngle = 0f, 125 | sweepAngle = 360f, 126 | useCenter = false, 127 | style = Stroke(12f) 128 | ) 129 | 130 | drawArc( 131 | color = if (isDay) dayColor else nightColor, 132 | startAngle = if (isDay) 180f else 0f, 133 | sweepAngle = sweepAngle, 134 | useCenter = false, 135 | style = Stroke(12f) 136 | ) 137 | 138 | with(drawContext.canvas) { 139 | val bgSize = 60f 140 | 141 | translate(iconOffset.x - bgSize / 2, iconOffset.y - bgSize / 2) { 142 | drawRoundRect( 143 | color = Color.White, 144 | size = androidx.compose.ui.geometry.Size(bgSize, bgSize), 145 | cornerRadius = androidx.compose.ui.geometry.CornerRadius(30f, 30f) 146 | ) 147 | } 148 | } 149 | 150 | with(painter) { 151 | val iconSize = 28f 152 | 153 | translate(iconOffset.x - iconSize / 2, iconOffset.y - iconSize / 2) { 154 | draw( 155 | size = Size(iconSize, iconSize), 156 | colorFilter = androidx.compose.ui.graphics.ColorFilter.tint(if (isDay) dayColor else nightColor) 157 | ) 158 | } 159 | } 160 | } 161 | } 162 | 163 | Column(horizontalAlignment = Alignment.CenterHorizontally) { 164 | Icon(painter = painterResource(Res.drawable.ic_sunrise), contentDescription = null, tint = nightColor) 165 | Spacer(modifier = Modifier.height(4.dp)) 166 | Text("Sunset", fontSize = 16.sp, color = Color.Gray) 167 | Text( 168 | "${sunset.hour.toString().padStart(2, '0')}:${sunset.minute.toString().padStart(2, '0')}", 169 | fontSize = 24.sp 170 | ) 171 | Spacer(modifier = Modifier.height(8.dp)) 172 | Text("${currentTime.value}", fontSize = 24.sp) 173 | Spacer(modifier = Modifier.height(8.dp)) 174 | Text("Sunrise", fontSize = 16.sp, color = Color.Gray) 175 | Text( 176 | "${sunrise.hour.toString().padStart(2, '0')}:${sunrise.minute.toString().padStart(2, '0')}", 177 | fontSize = 24.sp 178 | ) 179 | Spacer(modifier = Modifier.height(4.dp)) 180 | Icon(imageVector = Icons.Default.WbTwilight, contentDescription = null, tint = dayColor) 181 | } 182 | } 183 | 184 | 185 | @Preview 186 | @Composable 187 | fun PreviewSunriseSunsetUI() { 188 | MaterialTheme { 189 | SunriseNSunsetUI() 190 | } 191 | } -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/dev/sunnat629/FanRotation.kt: -------------------------------------------------------------------------------- 1 | package dev.sunnat629 2 | 3 | import androidx.compose.animation.core.* 4 | import androidx.compose.foundation.Image 5 | import androidx.compose.foundation.background 6 | import androidx.compose.foundation.layout.* 7 | import androidx.compose.material3.Button 8 | import androidx.compose.material3.Icon 9 | import androidx.compose.material3.Text 10 | import androidx.compose.runtime.* 11 | import androidx.compose.ui.Alignment 12 | import androidx.compose.ui.Modifier 13 | import androidx.compose.ui.graphics.Color 14 | import androidx.compose.ui.graphics.ColorFilter 15 | import androidx.compose.ui.graphics.graphicsLayer 16 | import androidx.compose.ui.unit.dp 17 | import composeproject.composeapp.generated.resources.Res 18 | import composeproject.composeapp.generated.resources.ic_fan 19 | import composeproject.composeapp.generated.resources.ic_sunrise 20 | import org.jetbrains.compose.resources.painterResource 21 | 22 | @Composable 23 | fun FanControlUI() { 24 | var isRunning by remember { mutableStateOf(false) } 25 | var rotationSpeed by remember { mutableStateOf(500L) } 26 | val rotationAngle = remember { Animatable(0f) } 27 | val scope = rememberCoroutineScope() 28 | 29 | // Fan Image Rotation Animation 30 | LaunchedEffect(isRunning, rotationSpeed) { 31 | while (isRunning) { 32 | rotationAngle.animateTo( 33 | targetValue = rotationAngle.value + 360f, 34 | animationSpec = tween(durationMillis = rotationSpeed.toInt(), easing = LinearEasing) 35 | ) 36 | } 37 | } 38 | 39 | Column( 40 | modifier = Modifier 41 | .fillMaxSize() 42 | .background(Color.Black), 43 | verticalArrangement = Arrangement.Center, 44 | horizontalAlignment = Alignment.CenterHorizontally 45 | ) { 46 | // Fan Image 47 | Icon( 48 | painter = painterResource(Res.drawable.ic_sunrise), 49 | contentDescription = null 50 | ) 51 | 52 | Image( 53 | painter = painterResource(Res.drawable.ic_fan), 54 | contentDescription = "Fan", 55 | colorFilter = ColorFilter.tint(Color.Cyan), 56 | modifier = Modifier 57 | .size(150.dp) 58 | .graphicsLayer(rotationZ = rotationAngle.value) 59 | ) 60 | 61 | Spacer(modifier = Modifier.height(32.dp)) 62 | 63 | // Control Buttons 64 | Row( 65 | horizontalArrangement = Arrangement.SpaceEvenly, 66 | modifier = Modifier.fillMaxWidth() 67 | ) { 68 | Button(onClick = { 69 | if (rotationSpeed > 100L) { 70 | rotationSpeed -= 100L 71 | } 72 | }) { 73 | Text("Speed Up") 74 | } 75 | 76 | Button(onClick = { 77 | isRunning = !isRunning 78 | }) { 79 | Text(if (isRunning) "Stop" else "Start") 80 | } 81 | 82 | Button(onClick = { 83 | if (rotationSpeed < 2000L) { 84 | rotationSpeed += 100L 85 | } 86 | }) { 87 | Text("Speed Down") 88 | } 89 | 90 | } 91 | } 92 | } -------------------------------------------------------------------------------- /composeApp/src/commonMain/kotlin/dev/sunnat629/SpiralAnimationUI.kt: -------------------------------------------------------------------------------- 1 | /** 2 | * Inspired by https://x.com/_take_hito_/status/1873978363444072731 3 | **/ 4 | 5 | package dev.sunnat629 6 | 7 | import androidx.compose.foundation.Canvas 8 | import androidx.compose.foundation.background 9 | import androidx.compose.foundation.gestures.detectTapGestures 10 | import androidx.compose.runtime.* 11 | import androidx.compose.ui.Modifier 12 | import androidx.compose.ui.geometry.Offset 13 | import androidx.compose.ui.geometry.Size 14 | import androidx.compose.ui.graphics.Color 15 | import androidx.compose.ui.input.pointer.pointerInput 16 | import androidx.compose.ui.layout.onSizeChanged 17 | import kotlinx.coroutines.delay 18 | import kotlinx.datetime.Clock 19 | import kotlin.math.PI 20 | import kotlin.math.abs 21 | import kotlin.math.cos 22 | import kotlin.math.sin 23 | 24 | val currentTime: Long get() = Clock.System.now().toEpochMilliseconds() 25 | 26 | @Composable 27 | fun SpiralAnimationUI(modifier: Modifier = Modifier) { 28 | // Holds the start time for the animation 29 | var start by remember { mutableStateOf(currentTime) } 30 | // Tracks the size of the canvas for centering the spiral 31 | var canvasSize by remember { mutableStateOf(Size.Zero) } 32 | val timeMs by remember { mutableStateOf(10L) } 33 | 34 | // LaunchedEffect to continuously update the start time for animation 35 | LaunchedEffect(Unit) { 36 | while (true) { 37 | delay(timeMs) 38 | start += timeMs 39 | } 40 | } 41 | 42 | // Canvas for custom drawing 43 | Canvas( 44 | modifier = modifier 45 | .background(Color.Black) 46 | .onSizeChanged { canvasSize = Size(it.width.toFloat(), it.height.toFloat()) } 47 | .pointerInput(Unit) { 48 | // Reset animation on tap 49 | detectTapGestures { start = currentTime } 50 | } 51 | ) { 52 | // Calculate elapsed time and rotation factor 53 | val time: Double = (currentTime - start) / 120.0 54 | val radius = 2.0 55 | val rotation = 0.7 + 0.3 * abs(sin(PI * time / 2) + 0.5) 56 | // Calculate the center point for the spiral 57 | val center = Offset(canvasSize.width / 2 - radius.toFloat(), canvasSize.height / 2 - radius.toFloat()) 58 | 59 | // Loop to draw multiple points in the spiral pattern 60 | for (i in 0 until 3000) { 61 | val j = (i + time) * 0.1f 62 | // val j = rotation * i // Rotate each point 63 | val p = Offset.spiralAt(j) / .5F // Calculate spiral position 64 | val pathOffset = Offset(center.x + p.x.toFloat(), center.y + p.y.toFloat()) 65 | drawCircle( 66 | color = Color.hsv(((j % 255 / 255f) * 360f).toFloat(), 0.6f, 1f), 67 | radius = radius.toFloat(), 68 | center = pathOffset 69 | ) 70 | } 71 | } 72 | } 73 | 74 | fun Offset.Companion.spiralAt(angle: Double): Offset { 75 | return Offset((angle * cos(angle).toFloat()).toFloat(), (angle * sin(angle).toFloat()).toFloat()) 76 | } -------------------------------------------------------------------------------- /composeApp/src/desktopMain/kotlin/dev/sunnat629/main.kt: -------------------------------------------------------------------------------- 1 | package dev.sunnat629 2 | 3 | import androidx.compose.ui.window.Window 4 | import androidx.compose.ui.window.application 5 | 6 | fun main() = application { 7 | Window( 8 | onCloseRequest = ::exitApplication, 9 | title = "ComposeProject", 10 | ) { 11 | App() 12 | } 13 | } -------------------------------------------------------------------------------- /composeApp/src/iosMain/kotlin/dev/sunnat629/MainViewController.kt: -------------------------------------------------------------------------------- 1 | package dev.sunnat629 2 | 3 | import androidx.compose.ui.window.ComposeUIViewController 4 | 5 | fun MainViewController() = ComposeUIViewController { App() } -------------------------------------------------------------------------------- /composeApp/src/wasmJsMain/kotlin/dev/sunnat629/main.kt: -------------------------------------------------------------------------------- 1 | package dev.sunnat629 2 | 3 | import androidx.compose.ui.ExperimentalComposeUiApi 4 | import androidx.compose.ui.window.ComposeViewport 5 | import kotlinx.browser.document 6 | 7 | @OptIn(ExperimentalComposeUiApi::class) 8 | fun main() { 9 | ComposeViewport(document.body!!) { 10 | App() 11 | } 12 | } -------------------------------------------------------------------------------- /composeApp/src/wasmJsMain/resources/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ComposeProject 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /composeApp/src/wasmJsMain/resources/styles.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | width: 100%; 3 | height: 100%; 4 | margin: 0; 5 | padding: 0; 6 | overflow: hidden; 7 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | #Kotlin 2 | kotlin.code.style=official 3 | kotlin.daemon.jvmargs=-Xmx2048M 4 | 5 | #Gradle 6 | org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 7 | org.gradle.daemon=true 8 | org.gradle.parallel=true 9 | org.gradle.caching=true 10 | org.gradle.workers.max=4 11 | org.gradle.configureondemand=true 12 | org.gradle.vfs.watch=true # Enable file system watching (Droplet can handle it) 13 | 14 | #Android 15 | android.nonTransitiveRClass=true 16 | android.useAndroidX=true 17 | 18 | #Ktor 19 | io.ktor.development=true 20 | 21 | # Performance Tweaks 22 | org.gradle.warning.mode=all 23 | org.gradle.console=plain 24 | org.gradle.build-cache=true 25 | org.gradle.status.buildcache=true 26 | org.gradle.idletimeout=120000 # Stop idle daemons after 2 minutes 27 | org.gradle.internal.repository.max-snapshot-age=30m 28 | 29 | # Dependency Resolution Tweaks 30 | org.gradle.dependency.verification=off 31 | kotlin.incremental=true 32 | kotlin.incremental.java=true 33 | kotlin.compiler.execution.strategy=daemon 34 | kotlin.compiler.jvmTarget=17 # Match JVM version 35 | 36 | # Network and Download Optimization 37 | org.gradle.parallel.threads=4 38 | systemProp.http.keepAlive=true 39 | systemProp.http.keepAlive.timeout=60 40 | systemProp.http.maxConnections=20 41 | -------------------------------------------------------------------------------- /gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | agp = "8.5.2" 3 | android-compileSdk = "35" 4 | android-minSdk = "24" 5 | android-targetSdk = "35" 6 | androidx-activityCompose = "1.9.3" 7 | androidx-appcompat = "1.7.0" 8 | androidx-constraintlayout = "2.2.0" 9 | androidx-core-ktx = "1.15.0" 10 | androidx-espresso-core = "3.6.1" 11 | androidx-lifecycle = "2.8.4" 12 | androidx-material = "1.12.0" 13 | androidx-test-junit = "1.2.1" 14 | compose-multiplatform = "1.7.0" 15 | junit = "4.13.2" 16 | kotlin = "2.1.0" 17 | kotlinx-coroutines = "1.9.0" 18 | ktor = "3.0.2" 19 | logback = "1.5.12" 20 | coil = "3.0.4" 21 | coil-network-ktor="3.0.0-alpha08" 22 | kotlinx-serialization = "1.7.3" 23 | buildConfig = "5.5.1" 24 | ksp = "2.1.0-1.0.29" 25 | kotlinxDatetime = "0.6.1" 26 | compose-navigation-version = "2.8.0-alpha11" 27 | 28 | 29 | [libraries] 30 | kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } 31 | kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" } 32 | junit = { group = "junit", name = "junit", version.ref = "junit" } 33 | androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core-ktx" } 34 | androidx-test-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-junit" } 35 | androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidx-espresso-core" } 36 | androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidx-appcompat" } 37 | androidx-material = { group = "com.google.android.material", name = "material", version.ref = "androidx-material" } 38 | androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "androidx-constraintlayout" } 39 | androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" } 40 | androidx-lifecycle-viewmodel = { group = "org.jetbrains.androidx.lifecycle", name = "lifecycle-viewmodel", version.ref = "androidx-lifecycle" } 41 | androidx-lifecycle-runtime-compose = { group = "org.jetbrains.androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "androidx-lifecycle" } 42 | kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } 43 | kotlinx-coroutines-swing = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" } 44 | logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" } 45 | ktor-server-core = { module = "io.ktor:ktor-server-core-jvm", version.ref = "ktor" } 46 | ktor-server-netty = { module = "io.ktor:ktor-server-netty-jvm", version.ref = "ktor" } 47 | ktor-server-tests = { module = "io.ktor:ktor-server-tests-jvm", version.ref = "ktor" } 48 | 49 | coil = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coil" } 50 | coil-ktor = { module = "io.coil-kt.coil3:coil-network-ktor", version.ref = "coil-network-ktor" } 51 | 52 | kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" } 53 | 54 | kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinxDatetime" } 55 | compose-navigation = { module = "org.jetbrains.androidx.navigation:navigation-compose", version.ref = "compose-navigation-version" } 56 | 57 | 58 | [bundles] 59 | coil-common = ["coil"] 60 | 61 | [plugins] 62 | androidApplication = { id = "com.android.application", version.ref = "agp" } 63 | androidLibrary = { id = "com.android.library", version.ref = "agp" } 64 | composeMultiplatform = { id = "org.jetbrains.compose", version.ref = "compose-multiplatform" } 65 | composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } 66 | kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } 67 | ktor = { id = "io.ktor.plugin", version.ref = "ktor" } 68 | kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } 69 | buildConfig = { id = "com.github.gmazzo.buildconfig", version.ref = "buildConfig" } 70 | kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } 71 | ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunnat629/ComposeProject/7c98d119b9a700c5989f1929eff898bfb8cde8cb/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # SPDX-License-Identifier: Apache-2.0 19 | # 20 | 21 | ############################################################################## 22 | # 23 | # Gradle start up script for POSIX generated by Gradle. 24 | # 25 | # Important for running: 26 | # 27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 28 | # noncompliant, but you have some other compliant shell such as ksh or 29 | # bash, then to run this script, type that shell name before the whole 30 | # command line, like: 31 | # 32 | # ksh Gradle 33 | # 34 | # Busybox and similar reduced shells will NOT work, because this script 35 | # requires all of these POSIX shell features: 36 | # * functions; 37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 39 | # * compound commands having a testable exit status, especially «case»; 40 | # * various built-in commands including «command», «set», and «ulimit». 41 | # 42 | # Important for patching: 43 | # 44 | # (2) This script targets any POSIX shell, so it avoids extensions provided 45 | # by Bash, Ksh, etc; in particular arrays are avoided. 46 | # 47 | # The "traditional" practice of packing multiple parameters into a 48 | # space-separated string is a well documented source of bugs and security 49 | # problems, so this is (mostly) avoided, by progressively accumulating 50 | # options in "$@", and eventually passing that to Java. 51 | # 52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 54 | # see the in-line comments for details. 55 | # 56 | # There are tweaks for specific operating systems such as AIX, CygWin, 57 | # Darwin, MinGW, and NonStop. 58 | # 59 | # (3) This script is generated from the Groovy template 60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 61 | # within the Gradle project. 62 | # 63 | # You can find Gradle at https://github.com/gradle/gradle/. 64 | # 65 | ############################################################################## 66 | 67 | # Attempt to set APP_HOME 68 | 69 | # Resolve links: $0 may be a link 70 | app_path=$0 71 | 72 | # Need this for daisy-chained symlinks. 73 | while 74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 75 | [ -h "$app_path" ] 76 | do 77 | ls=$( ls -ld "$app_path" ) 78 | link=${ls#*' -> '} 79 | case $link in #( 80 | /*) app_path=$link ;; #( 81 | *) app_path=$APP_HOME$link ;; 82 | esac 83 | done 84 | 85 | # This is normally unused 86 | # shellcheck disable=SC2034 87 | APP_BASE_NAME=${0##*/} 88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s 90 | ' "$PWD" ) || exit 91 | 92 | # Use the maximum available, or set MAX_FD != -1 to use that value. 93 | MAX_FD=maximum 94 | 95 | warn () { 96 | echo "$*" 97 | } >&2 98 | 99 | die () { 100 | echo 101 | echo "$*" 102 | echo 103 | exit 1 104 | } >&2 105 | 106 | # OS specific support (must be 'true' or 'false'). 107 | cygwin=false 108 | msys=false 109 | darwin=false 110 | nonstop=false 111 | case "$( uname )" in #( 112 | CYGWIN* ) cygwin=true ;; #( 113 | Darwin* ) darwin=true ;; #( 114 | MSYS* | MINGW* ) msys=true ;; #( 115 | NONSTOP* ) nonstop=true ;; 116 | esac 117 | 118 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 119 | 120 | 121 | # Determine the Java command to use to start the JVM. 122 | if [ -n "$JAVA_HOME" ] ; then 123 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 124 | # IBM's JDK on AIX uses strange locations for the executables 125 | JAVACMD=$JAVA_HOME/jre/sh/java 126 | else 127 | JAVACMD=$JAVA_HOME/bin/java 128 | fi 129 | if [ ! -x "$JAVACMD" ] ; then 130 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 131 | 132 | Please set the JAVA_HOME variable in your environment to match the 133 | location of your Java installation." 134 | fi 135 | else 136 | JAVACMD=java 137 | if ! command -v java >/dev/null 2>&1 138 | then 139 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 140 | 141 | Please set the JAVA_HOME variable in your environment to match the 142 | location of your Java installation." 143 | fi 144 | fi 145 | 146 | # Increase the maximum file descriptors if we can. 147 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 148 | case $MAX_FD in #( 149 | max*) 150 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 151 | # shellcheck disable=SC2039,SC3045 152 | MAX_FD=$( ulimit -H -n ) || 153 | warn "Could not query maximum file descriptor limit" 154 | esac 155 | case $MAX_FD in #( 156 | '' | soft) :;; #( 157 | *) 158 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 159 | # shellcheck disable=SC2039,SC3045 160 | ulimit -n "$MAX_FD" || 161 | warn "Could not set maximum file descriptor limit to $MAX_FD" 162 | esac 163 | fi 164 | 165 | # Collect all arguments for the java command, stacking in reverse order: 166 | # * args from the command line 167 | # * the main class name 168 | # * -classpath 169 | # * -D...appname settings 170 | # * --module-path (only if needed) 171 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 172 | 173 | # For Cygwin or MSYS, switch paths to Windows format before running java 174 | if "$cygwin" || "$msys" ; then 175 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 176 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 177 | 178 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 179 | 180 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 181 | for arg do 182 | if 183 | case $arg in #( 184 | -*) false ;; # don't mess with options #( 185 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 186 | [ -e "$t" ] ;; #( 187 | *) false ;; 188 | esac 189 | then 190 | arg=$( cygpath --path --ignore --mixed "$arg" ) 191 | fi 192 | # Roll the args list around exactly as many times as the number of 193 | # args, so each arg winds up back in the position where it started, but 194 | # possibly modified. 195 | # 196 | # NB: a `for` loop captures its iteration list before it begins, so 197 | # changing the positional parameters here affects neither the number of 198 | # iterations, nor the values presented in `arg`. 199 | shift # remove old arg 200 | set -- "$@" "$arg" # push replacement arg 201 | done 202 | fi 203 | 204 | 205 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 206 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 207 | 208 | # Collect all arguments for the java command: 209 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 210 | # and any embedded shellness will be escaped. 211 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 212 | # treated as '${Hostname}' itself on the command line. 213 | 214 | set -- \ 215 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 216 | -classpath "$CLASSPATH" \ 217 | org.gradle.wrapper.GradleWrapperMain \ 218 | "$@" 219 | 220 | # Stop when "xargs" is not available. 221 | if ! command -v xargs >/dev/null 2>&1 222 | then 223 | die "xargs is not available" 224 | fi 225 | 226 | # Use "xargs" to parse quoted args. 227 | # 228 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 229 | # 230 | # In Bash we could simply go: 231 | # 232 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 233 | # set -- "${ARGS[@]}" "$@" 234 | # 235 | # but POSIX shell has neither arrays nor command substitution, so instead we 236 | # post-process each arg (as a line of input to sed) to backslash-escape any 237 | # character that might be a shell metacharacter, then use eval to reverse 238 | # that process (while maintaining the separation between arguments), and wrap 239 | # the whole thing up as a single "set" statement. 240 | # 241 | # This will of course break if any of these variables contains a newline or 242 | # an unmatched quote. 243 | # 244 | 245 | eval "set -- $( 246 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 247 | xargs -n1 | 248 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 249 | tr '\n' ' ' 250 | )" '"$@"' 251 | 252 | exec "$JAVACMD" "$@" 253 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /iosApp/Configuration/Config.xcconfig: -------------------------------------------------------------------------------- 1 | TEAM_ID= 2 | BUNDLE_ID=dev.sunnat629.ComposeProject 3 | APP_NAME=ComposeProject -------------------------------------------------------------------------------- /iosApp/iosApp.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 56; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; }; 11 | 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; }; 12 | 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; }; 13 | 7555FF83242A565900829871 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF82242A565900829871 /* ContentView.swift */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXFileReference section */ 17 | 058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 18 | 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 19 | 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; }; 20 | 7555FF7B242A565900829871 /* ComposeProject.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ComposeProject.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 22 | 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 23 | AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; }; 24 | /* End PBXFileReference section */ 25 | 26 | /* Begin PBXFrameworksBuildPhase section */ 27 | B92378962B6B1156000C7307 /* Frameworks */ = { 28 | isa = PBXFrameworksBuildPhase; 29 | buildActionMask = 2147483647; 30 | files = ( 31 | ); 32 | runOnlyForDeploymentPostprocessing = 0; 33 | }; 34 | /* End PBXFrameworksBuildPhase section */ 35 | 36 | /* Begin PBXGroup section */ 37 | 058557D7273AAEEB004C7B11 /* Preview Content */ = { 38 | isa = PBXGroup; 39 | children = ( 40 | 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */, 41 | ); 42 | path = "Preview Content"; 43 | sourceTree = ""; 44 | }; 45 | 42799AB246E5F90AF97AA0EF /* Frameworks */ = { 46 | isa = PBXGroup; 47 | children = ( 48 | ); 49 | name = Frameworks; 50 | sourceTree = ""; 51 | }; 52 | 7555FF72242A565900829871 = { 53 | isa = PBXGroup; 54 | children = ( 55 | AB1DB47929225F7C00F7AF9C /* Configuration */, 56 | 7555FF7D242A565900829871 /* iosApp */, 57 | 7555FF7C242A565900829871 /* Products */, 58 | 42799AB246E5F90AF97AA0EF /* Frameworks */, 59 | ); 60 | sourceTree = ""; 61 | }; 62 | 7555FF7C242A565900829871 /* Products */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | 7555FF7B242A565900829871 /* ComposeProject.app */, 66 | ); 67 | name = Products; 68 | sourceTree = ""; 69 | }; 70 | 7555FF7D242A565900829871 /* iosApp */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 058557BA273AAA24004C7B11 /* Assets.xcassets */, 74 | 7555FF82242A565900829871 /* ContentView.swift */, 75 | 7555FF8C242A565B00829871 /* Info.plist */, 76 | 2152FB032600AC8F00CF470E /* iOSApp.swift */, 77 | 058557D7273AAEEB004C7B11 /* Preview Content */, 78 | ); 79 | path = iosApp; 80 | sourceTree = ""; 81 | }; 82 | AB1DB47929225F7C00F7AF9C /* Configuration */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | AB3632DC29227652001CCB65 /* Config.xcconfig */, 86 | ); 87 | path = Configuration; 88 | sourceTree = ""; 89 | }; 90 | /* End PBXGroup section */ 91 | 92 | /* Begin PBXNativeTarget section */ 93 | 7555FF7A242A565900829871 /* iosApp */ = { 94 | isa = PBXNativeTarget; 95 | buildConfigurationList = 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */; 96 | buildPhases = ( 97 | F36B1CEB2AD83DDC00CB74D5 /* Compile Kotlin Framework */, 98 | 7555FF77242A565900829871 /* Sources */, 99 | B92378962B6B1156000C7307 /* Frameworks */, 100 | 7555FF79242A565900829871 /* Resources */, 101 | ); 102 | buildRules = ( 103 | ); 104 | dependencies = ( 105 | ); 106 | name = iosApp; 107 | packageProductDependencies = ( 108 | ); 109 | productName = iosApp; 110 | productReference = 7555FF7B242A565900829871 /* ComposeProject.app */; 111 | productType = "com.apple.product-type.application"; 112 | }; 113 | /* End PBXNativeTarget section */ 114 | 115 | /* Begin PBXProject section */ 116 | 7555FF73242A565900829871 /* Project object */ = { 117 | isa = PBXProject; 118 | attributes = { 119 | BuildIndependentTargetsInParallel = YES; 120 | LastSwiftUpdateCheck = 1130; 121 | LastUpgradeCheck = 1540; 122 | ORGANIZATIONNAME = orgName; 123 | TargetAttributes = { 124 | 7555FF7A242A565900829871 = { 125 | CreatedOnToolsVersion = 11.3.1; 126 | }; 127 | }; 128 | }; 129 | buildConfigurationList = 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */; 130 | compatibilityVersion = "Xcode 14.0"; 131 | developmentRegion = en; 132 | hasScannedForEncodings = 0; 133 | knownRegions = ( 134 | en, 135 | Base, 136 | ); 137 | mainGroup = 7555FF72242A565900829871; 138 | packageReferences = ( 139 | ); 140 | productRefGroup = 7555FF7C242A565900829871 /* Products */; 141 | projectDirPath = ""; 142 | projectRoot = ""; 143 | targets = ( 144 | 7555FF7A242A565900829871 /* iosApp */, 145 | ); 146 | }; 147 | /* End PBXProject section */ 148 | 149 | /* Begin PBXResourcesBuildPhase section */ 150 | 7555FF79242A565900829871 /* Resources */ = { 151 | isa = PBXResourcesBuildPhase; 152 | buildActionMask = 2147483647; 153 | files = ( 154 | 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */, 155 | 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */, 156 | ); 157 | runOnlyForDeploymentPostprocessing = 0; 158 | }; 159 | /* End PBXResourcesBuildPhase section */ 160 | 161 | /* Begin PBXShellScriptBuildPhase section */ 162 | F36B1CEB2AD83DDC00CB74D5 /* Compile Kotlin Framework */ = { 163 | isa = PBXShellScriptBuildPhase; 164 | buildActionMask = 2147483647; 165 | files = ( 166 | ); 167 | inputFileListPaths = ( 168 | ); 169 | inputPaths = ( 170 | ); 171 | name = "Compile Kotlin Framework"; 172 | outputFileListPaths = ( 173 | ); 174 | outputPaths = ( 175 | ); 176 | runOnlyForDeploymentPostprocessing = 0; 177 | shellPath = /bin/sh; 178 | shellScript = "if [ \"YES\" = \"$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED\" ]; then\n echo \"Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \\\"YES\\\"\"\n exit 0\nfi\ncd \"$SRCROOT/..\"\n./gradlew :composeApp:embedAndSignAppleFrameworkForXcode\n"; 179 | }; 180 | /* End PBXShellScriptBuildPhase section */ 181 | 182 | /* Begin PBXSourcesBuildPhase section */ 183 | 7555FF77242A565900829871 /* Sources */ = { 184 | isa = PBXSourcesBuildPhase; 185 | buildActionMask = 2147483647; 186 | files = ( 187 | 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */, 188 | 7555FF83242A565900829871 /* ContentView.swift in Sources */, 189 | ); 190 | runOnlyForDeploymentPostprocessing = 0; 191 | }; 192 | /* End PBXSourcesBuildPhase section */ 193 | 194 | /* Begin XCBuildConfiguration section */ 195 | 7555FFA3242A565B00829871 /* Debug */ = { 196 | isa = XCBuildConfiguration; 197 | baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */; 198 | buildSettings = { 199 | ALWAYS_SEARCH_USER_PATHS = NO; 200 | CLANG_ANALYZER_NONNULL = YES; 201 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 202 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 203 | CLANG_CXX_LIBRARY = "libc++"; 204 | CLANG_ENABLE_MODULES = YES; 205 | CLANG_ENABLE_OBJC_ARC = YES; 206 | CLANG_ENABLE_OBJC_WEAK = YES; 207 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 208 | CLANG_WARN_BOOL_CONVERSION = YES; 209 | CLANG_WARN_COMMA = YES; 210 | CLANG_WARN_CONSTANT_CONVERSION = YES; 211 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 212 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 213 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 214 | CLANG_WARN_EMPTY_BODY = YES; 215 | CLANG_WARN_ENUM_CONVERSION = YES; 216 | CLANG_WARN_INFINITE_RECURSION = YES; 217 | CLANG_WARN_INT_CONVERSION = YES; 218 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 219 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 220 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 221 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 222 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 223 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 224 | CLANG_WARN_STRICT_PROTOTYPES = YES; 225 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 226 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 227 | CLANG_WARN_UNREACHABLE_CODE = YES; 228 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 229 | COPY_PHASE_STRIP = NO; 230 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 231 | ENABLE_STRICT_OBJC_MSGSEND = YES; 232 | ENABLE_TESTABILITY = YES; 233 | ENABLE_USER_SCRIPT_SANDBOXING = NO; 234 | GCC_C_LANGUAGE_STANDARD = gnu11; 235 | GCC_DYNAMIC_NO_PIC = NO; 236 | GCC_NO_COMMON_BLOCKS = YES; 237 | GCC_OPTIMIZATION_LEVEL = 0; 238 | GCC_PREPROCESSOR_DEFINITIONS = ( 239 | "DEBUG=1", 240 | "$(inherited)", 241 | ); 242 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 243 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 244 | GCC_WARN_UNDECLARED_SELECTOR = YES; 245 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 246 | GCC_WARN_UNUSED_FUNCTION = YES; 247 | GCC_WARN_UNUSED_VARIABLE = YES; 248 | IPHONEOS_DEPLOYMENT_TARGET = 15.3; 249 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 250 | MTL_FAST_MATH = YES; 251 | ONLY_ACTIVE_ARCH = YES; 252 | SDKROOT = iphoneos; 253 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 254 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 255 | }; 256 | name = Debug; 257 | }; 258 | 7555FFA4242A565B00829871 /* Release */ = { 259 | isa = XCBuildConfiguration; 260 | baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */; 261 | buildSettings = { 262 | ALWAYS_SEARCH_USER_PATHS = NO; 263 | CLANG_ANALYZER_NONNULL = YES; 264 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 265 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 266 | CLANG_CXX_LIBRARY = "libc++"; 267 | CLANG_ENABLE_MODULES = YES; 268 | CLANG_ENABLE_OBJC_ARC = YES; 269 | CLANG_ENABLE_OBJC_WEAK = YES; 270 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 271 | CLANG_WARN_BOOL_CONVERSION = YES; 272 | CLANG_WARN_COMMA = YES; 273 | CLANG_WARN_CONSTANT_CONVERSION = YES; 274 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 275 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 276 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 277 | CLANG_WARN_EMPTY_BODY = YES; 278 | CLANG_WARN_ENUM_CONVERSION = YES; 279 | CLANG_WARN_INFINITE_RECURSION = YES; 280 | CLANG_WARN_INT_CONVERSION = YES; 281 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 282 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 283 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 284 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 285 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 286 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 287 | CLANG_WARN_STRICT_PROTOTYPES = YES; 288 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 289 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 290 | CLANG_WARN_UNREACHABLE_CODE = YES; 291 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 292 | COPY_PHASE_STRIP = NO; 293 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 294 | ENABLE_NS_ASSERTIONS = NO; 295 | ENABLE_STRICT_OBJC_MSGSEND = YES; 296 | ENABLE_USER_SCRIPT_SANDBOXING = NO; 297 | GCC_C_LANGUAGE_STANDARD = gnu11; 298 | GCC_NO_COMMON_BLOCKS = YES; 299 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 300 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 301 | GCC_WARN_UNDECLARED_SELECTOR = YES; 302 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 303 | GCC_WARN_UNUSED_FUNCTION = YES; 304 | GCC_WARN_UNUSED_VARIABLE = YES; 305 | IPHONEOS_DEPLOYMENT_TARGET = 15.3; 306 | MTL_ENABLE_DEBUG_INFO = NO; 307 | MTL_FAST_MATH = YES; 308 | SDKROOT = iphoneos; 309 | SWIFT_COMPILATION_MODE = wholemodule; 310 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 311 | VALIDATE_PRODUCT = YES; 312 | }; 313 | name = Release; 314 | }; 315 | 7555FFA6242A565B00829871 /* Debug */ = { 316 | isa = XCBuildConfiguration; 317 | buildSettings = { 318 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 319 | CODE_SIGN_IDENTITY = "Apple Development"; 320 | CODE_SIGN_STYLE = Automatic; 321 | DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; 322 | DEVELOPMENT_TEAM = "${TEAM_ID}"; 323 | ENABLE_PREVIEWS = YES; 324 | FRAMEWORK_SEARCH_PATHS = ( 325 | "$(inherited)", 326 | "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)\n$(SRCROOT)/../composeApp/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)", 327 | ); 328 | INFOPLIST_FILE = iosApp/Info.plist; 329 | IPHONEOS_DEPLOYMENT_TARGET = 15.3; 330 | LD_RUNPATH_SEARCH_PATHS = ( 331 | "$(inherited)", 332 | "@executable_path/Frameworks", 333 | ); 334 | PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}"; 335 | PRODUCT_NAME = "${APP_NAME}"; 336 | PROVISIONING_PROFILE_SPECIFIER = ""; 337 | SWIFT_VERSION = 5.0; 338 | TARGETED_DEVICE_FAMILY = "1,2"; 339 | }; 340 | name = Debug; 341 | }; 342 | 7555FFA7242A565B00829871 /* Release */ = { 343 | isa = XCBuildConfiguration; 344 | buildSettings = { 345 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 346 | CODE_SIGN_IDENTITY = "Apple Development"; 347 | CODE_SIGN_STYLE = Automatic; 348 | DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; 349 | DEVELOPMENT_TEAM = "${TEAM_ID}"; 350 | ENABLE_PREVIEWS = YES; 351 | FRAMEWORK_SEARCH_PATHS = ( 352 | "$(inherited)", 353 | "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)\n$(SRCROOT)/../composeApp/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)", 354 | ); 355 | INFOPLIST_FILE = iosApp/Info.plist; 356 | IPHONEOS_DEPLOYMENT_TARGET = 15.3; 357 | LD_RUNPATH_SEARCH_PATHS = ( 358 | "$(inherited)", 359 | "@executable_path/Frameworks", 360 | ); 361 | PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}"; 362 | PRODUCT_NAME = "${APP_NAME}"; 363 | PROVISIONING_PROFILE_SPECIFIER = ""; 364 | SWIFT_VERSION = 5.0; 365 | TARGETED_DEVICE_FAMILY = "1,2"; 366 | }; 367 | name = Release; 368 | }; 369 | /* End XCBuildConfiguration section */ 370 | 371 | /* Begin XCConfigurationList section */ 372 | 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */ = { 373 | isa = XCConfigurationList; 374 | buildConfigurations = ( 375 | 7555FFA3242A565B00829871 /* Debug */, 376 | 7555FFA4242A565B00829871 /* Release */, 377 | ); 378 | defaultConfigurationIsVisible = 0; 379 | defaultConfigurationName = Release; 380 | }; 381 | 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */ = { 382 | isa = XCConfigurationList; 383 | buildConfigurations = ( 384 | 7555FFA6242A565B00829871 /* Debug */, 385 | 7555FFA7242A565B00829871 /* Release */, 386 | ); 387 | defaultConfigurationIsVisible = 0; 388 | defaultConfigurationName = Release; 389 | }; 390 | /* End XCConfigurationList section */ 391 | }; 392 | rootObject = 7555FF73242A565900829871 /* Project object */; 393 | } -------------------------------------------------------------------------------- /iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } -------------------------------------------------------------------------------- /iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "app-icon-1024.png", 5 | "idiom" : "universal", 6 | "platform" : "ios", 7 | "size" : "1024x1024" 8 | } 9 | ], 10 | "info" : { 11 | "author" : "xcode", 12 | "version" : 1 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunnat629/ComposeProject/7c98d119b9a700c5989f1929eff898bfb8cde8cb/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png -------------------------------------------------------------------------------- /iosApp/iosApp/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } -------------------------------------------------------------------------------- /iosApp/iosApp/ContentView.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import SwiftUI 3 | import ComposeApp 4 | 5 | struct ComposeView: UIViewControllerRepresentable { 6 | func makeUIViewController(context: Context) -> UIViewController { 7 | MainViewControllerKt.MainViewController() 8 | } 9 | 10 | func updateUIViewController(_ uiViewController: UIViewController, context: Context) {} 11 | } 12 | 13 | struct ContentView: View { 14 | var body: some View { 15 | ComposeView() 16 | .ignoresSafeArea(.keyboard) // Compose has own keyboard handler 17 | } 18 | } 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /iosApp/iosApp/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | CADisableMinimumFrameDurationOnPhone 24 | 25 | UIApplicationSceneManifest 26 | 27 | UIApplicationSupportsMultipleScenes 28 | 29 | 30 | UILaunchScreen 31 | 32 | UIRequiredDeviceCapabilities 33 | 34 | armv7 35 | 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UISupportedInterfaceOrientations~ipad 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationPortraitUpsideDown 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } -------------------------------------------------------------------------------- /iosApp/iosApp/iOSApp.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | 3 | @main 4 | struct iOSApp: App { 5 | var body: some Scene { 6 | WindowGroup { 7 | ContentView() 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /server/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | alias(libs.plugins.kotlinJvm) 3 | alias(libs.plugins.ktor) 4 | application 5 | } 6 | 7 | group = "dev.sunnat629" 8 | version = "1.0.0" 9 | application { 10 | mainClass.set("dev.sunnat629.ApplicationKt") 11 | applicationDefaultJvmArgs = listOf("-Dio.ktor.development=${extra["io.ktor.development"] ?: "false"}") 12 | } 13 | 14 | dependencies { 15 | implementation(projects.shared) 16 | implementation(libs.logback) 17 | implementation(libs.ktor.server.core) 18 | implementation(libs.ktor.server.netty) 19 | testImplementation(libs.ktor.server.tests) 20 | testImplementation(libs.kotlin.test.junit) 21 | } -------------------------------------------------------------------------------- /server/src/main/kotlin/dev/sunnat629/Application.kt: -------------------------------------------------------------------------------- 1 | package dev.sunnat629 2 | 3 | import io.ktor.server.application.* 4 | import io.ktor.server.engine.* 5 | import io.ktor.server.netty.* 6 | import io.ktor.server.response.* 7 | import io.ktor.server.routing.* 8 | 9 | fun main() { 10 | embeddedServer(Netty, port = SERVER_PORT, host = "0.0.0.0", module = Application::module) 11 | .start(wait = true) 12 | } 13 | 14 | fun Application.module() { 15 | routing { 16 | get("/") { 17 | call.respondText("Ktor: ${Greeting().greet()}") 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /server/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "ComposeProject" 2 | enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") 3 | 4 | pluginManagement { 5 | repositories { 6 | google { 7 | mavenContent { 8 | includeGroupAndSubgroups("androidx") 9 | includeGroupAndSubgroups("com.android") 10 | includeGroupAndSubgroups("com.google") 11 | } 12 | } 13 | mavenCentral() 14 | gradlePluginPortal() 15 | } 16 | } 17 | 18 | dependencyResolutionManagement { 19 | repositories { 20 | google { 21 | mavenContent { 22 | includeGroupAndSubgroups("androidx") 23 | includeGroupAndSubgroups("com.android") 24 | includeGroupAndSubgroups("com.google") 25 | } 26 | } 27 | mavenCentral() 28 | } 29 | } 30 | 31 | include(":composeApp") 32 | include(":server") 33 | include(":shared") -------------------------------------------------------------------------------- /shared/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi 2 | import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl 3 | import org.jetbrains.kotlin.gradle.dsl.JvmTarget 4 | import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig 5 | 6 | plugins { 7 | alias(libs.plugins.kotlinMultiplatform) 8 | alias(libs.plugins.androidLibrary) 9 | } 10 | 11 | kotlin { 12 | androidTarget { 13 | compilerOptions { 14 | jvmTarget.set(JvmTarget.JVM_11) 15 | } 16 | } 17 | 18 | iosX64() 19 | iosArm64() 20 | iosSimulatorArm64() 21 | 22 | jvm() 23 | 24 | @OptIn(ExperimentalWasmDsl::class) 25 | wasmJs { 26 | browser { 27 | val rootDirPath = project.rootDir.path 28 | val projectDirPath = project.projectDir.path 29 | commonWebpackConfig { 30 | devServer = (devServer ?: KotlinWebpackConfig.DevServer()).apply { 31 | static = (static ?: mutableListOf()).apply { 32 | // Serve sources to debug inside browser 33 | add(rootDirPath) 34 | add(projectDirPath) 35 | } 36 | } 37 | } 38 | } 39 | } 40 | 41 | sourceSets { 42 | commonMain.dependencies { 43 | // put your Multiplatform dependencies here 44 | } 45 | } 46 | } 47 | 48 | android { 49 | namespace = "dev.sunnat629.shared" 50 | compileSdk = libs.versions.android.compileSdk.get().toInt() 51 | compileOptions { 52 | sourceCompatibility = JavaVersion.VERSION_11 53 | targetCompatibility = JavaVersion.VERSION_11 54 | } 55 | defaultConfig { 56 | minSdk = libs.versions.android.minSdk.get().toInt() 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /shared/src/androidMain/kotlin/dev/sunnat629/Platform.android.kt: -------------------------------------------------------------------------------- 1 | package dev.sunnat629 2 | 3 | import android.os.Build 4 | 5 | class AndroidPlatform : Platform { 6 | override val name: String = "Android ${Build.VERSION.SDK_INT}" 7 | } 8 | 9 | actual fun getPlatform(): Platform = AndroidPlatform() -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/dev/sunnat629/Constants.kt: -------------------------------------------------------------------------------- 1 | package dev.sunnat629 2 | 3 | const val SERVER_PORT = 8080 -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/dev/sunnat629/Greeting.kt: -------------------------------------------------------------------------------- 1 | package dev.sunnat629 2 | 3 | class Greeting { 4 | private val platform = getPlatform() 5 | 6 | fun greet(): String { 7 | return "${platform.name}!" 8 | } 9 | } -------------------------------------------------------------------------------- /shared/src/commonMain/kotlin/dev/sunnat629/Platform.kt: -------------------------------------------------------------------------------- 1 | package dev.sunnat629 2 | 3 | interface Platform { 4 | val name: String 5 | } 6 | 7 | expect fun getPlatform(): Platform -------------------------------------------------------------------------------- /shared/src/iosMain/kotlin/dev/sunnat629/Platform.ios.kt: -------------------------------------------------------------------------------- 1 | package dev.sunnat629 2 | 3 | import platform.UIKit.UIDevice 4 | 5 | class IOSPlatform: Platform { 6 | override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion 7 | } 8 | 9 | actual fun getPlatform(): Platform = IOSPlatform() -------------------------------------------------------------------------------- /shared/src/jvmMain/kotlin/dev/sunnat629/Platform.jvm.kt: -------------------------------------------------------------------------------- 1 | package dev.sunnat629 2 | 3 | class JVMPlatform: Platform { 4 | override val name: String = "Java ${System.getProperty("java.version")}" 5 | } 6 | 7 | actual fun getPlatform(): Platform = JVMPlatform() -------------------------------------------------------------------------------- /shared/src/wasmJsMain/kotlin/dev/sunnat629/Platform.wasmJs.kt: -------------------------------------------------------------------------------- 1 | package dev.sunnat629 2 | 3 | class WasmPlatform: Platform { 4 | override val name: String = "Web with Kotlin/Wasm" 5 | } 6 | 7 | actual fun getPlatform(): Platform = WasmPlatform() --------------------------------------------------------------------------------