-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
756b070
commit 7c01853
Showing
25 changed files
with
89 additions
and
4 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
plugins { | ||
kotlin("multiplatform") | ||
alias(libs.plugins.library) | ||
} | ||
|
||
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi::class) | ||
kotlin { | ||
targetHierarchy.default() | ||
|
||
androidTarget { | ||
compilations.all { | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
} | ||
} | ||
|
||
listOf( | ||
iosX64(), | ||
iosArm64(), | ||
iosSimulatorArm64() | ||
).forEach { | ||
it.binaries.framework { | ||
baseName = "shared" | ||
} | ||
} | ||
|
||
sourceSets { | ||
val commonMain by getting { | ||
dependencies { | ||
//put your multiplatform dependencies here | ||
} | ||
} | ||
val commonTest by getting { | ||
dependencies { | ||
//implementation(libs.kotlin.test) | ||
} | ||
} | ||
} | ||
} | ||
|
||
android { | ||
namespace = "org.michaelbel.movies.shared" | ||
|
||
compileSdk = libs.versions.compile.sdk.get().toInt() | ||
|
||
defaultConfig { | ||
minSdk = libs.versions.min.sdk.get().toInt() | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
shared/src/androidMain/kotlin/org/michaelbel/movies/shared/Platform.android.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.michaelbel.movies.shared | ||
|
||
import android.os.Build | ||
|
||
class AndroidPlatform: Platform { | ||
override val name: String = "Android ${Build.VERSION.SDK_INT}" | ||
} | ||
|
||
actual fun getPlatform(): Platform = AndroidPlatform() |
9 changes: 9 additions & 0 deletions
9
shared/src/commonMain/kotlin/org/michaelbel/movies/shared/Greeting.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.michaelbel.movies.shared | ||
|
||
class Greeting { | ||
private val platform: Platform = getPlatform() | ||
|
||
fun greet(): String { | ||
return "Hello, ${platform.name}!" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
shared/src/commonMain/kotlin/org/michaelbel/movies/shared/Platform.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.michaelbel.movies.shared | ||
|
||
interface Platform { | ||
val name: String | ||
} | ||
|
||
expect fun getPlatform(): Platform |
9 changes: 9 additions & 0 deletions
9
shared/src/iosMain/kotlin/org/michaelbel/movies/shared/Platform.ios.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.michaelbel.movies.shared | ||
|
||
import platform.UIKit.UIDevice | ||
|
||
class IOSPlatform: Platform { | ||
override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion | ||
} | ||
|
||
actual fun getPlatform(): Platform = IOSPlatform() |