Skip to content

Commit

Permalink
Merge pull request #37 from 2rabs/rt/add-app-shared-module
Browse files Browse the repository at this point in the history
✨ :app:shared モジュールを追加
  • Loading branch information
tatsutakein authored Nov 22, 2023
2 parents d8047a2 + 9ed577d commit 6ddf79b
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/shared/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Shared
33 changes: 33 additions & 0 deletions app/shared/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
plugins {
id("nito.primitive.kmp")
id("nito.primitive.kmp.android")
id("nito.primitive.kmp.ios")
id("nito.primitive.kmp.compose")
id("nito.primitive.detekt")
}

android.namespace = "club.nito.app.shared"

kotlin {
sourceSets {
commonMain {
dependencies {
implementation(projects.core.common)
implementation(projects.core.model)
implementation(projects.core.domain)
implementation(projects.core.ui)
implementation(projects.core.designsystem)

implementation(libs.kotlinxCoroutinesCore)

implementation(libs.koin)
implementation(libs.koinCompose)
}
}
iosMain {
dependencies {
implementation(libs.koin)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package club.nito.core.common

class AndroidPlatform : Platform {
override val name: String = "Android ${android.os.Build.VERSION.SDK_INT}"
}

actual fun getPlatform(): Platform = AndroidPlatform()
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package club.nito.core.common

class Greeting {
private val platform: Platform = getPlatform()

fun greet(): String {
return "Hello, ${platform.name}!"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package club.nito.core.common

interface Platform {
val name: String
}

expect fun getPlatform(): Platform
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package club.nito.core.common

import platform.UIKit.UIDevice

class IOSPlatform: Platform {
override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion
}

actual fun getPlatform(): Platform = IOSPlatform()
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencyResolutionManagement {
rootProject.name = "nito"

include(
":app:shared",
":app:android",
":app:ios-combined",
":app:web",
Expand Down

0 comments on commit 6ddf79b

Please sign in to comment.