chore: initial commit
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package su.reya.coop
|
||||
|
||||
import android.os.Build
|
||||
|
||||
class AndroidPlatform : Platform {
|
||||
override val name: String = "Android ${Build.VERSION.SDK_INT}"
|
||||
}
|
||||
|
||||
actual fun getPlatform(): Platform = AndroidPlatform()
|
||||
9
shared/src/commonMain/kotlin/su/reya/coop/Greeting.kt
Normal file
9
shared/src/commonMain/kotlin/su/reya/coop/Greeting.kt
Normal file
@@ -0,0 +1,9 @@
|
||||
package su.reya.coop
|
||||
|
||||
class Greeting {
|
||||
private val platform = getPlatform()
|
||||
|
||||
fun greet(): String {
|
||||
return "Hello, ${platform.name}!"
|
||||
}
|
||||
}
|
||||
7
shared/src/commonMain/kotlin/su/reya/coop/Platform.kt
Normal file
7
shared/src/commonMain/kotlin/su/reya/coop/Platform.kt
Normal file
@@ -0,0 +1,7 @@
|
||||
package su.reya.coop
|
||||
|
||||
interface Platform {
|
||||
val name: String
|
||||
}
|
||||
|
||||
expect fun getPlatform(): Platform
|
||||
@@ -0,0 +1,12 @@
|
||||
package su.reya.coop
|
||||
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class SharedCommonTest {
|
||||
|
||||
@Test
|
||||
fun example() {
|
||||
assertEquals(3, 1 + 2)
|
||||
}
|
||||
}
|
||||
9
shared/src/iosMain/kotlin/su/reya/coop/Platform.ios.kt
Normal file
9
shared/src/iosMain/kotlin/su/reya/coop/Platform.ios.kt
Normal file
@@ -0,0 +1,9 @@
|
||||
package su.reya.coop
|
||||
|
||||
import platform.UIKit.UIDevice
|
||||
|
||||
class IOSPlatform: Platform {
|
||||
override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion
|
||||
}
|
||||
|
||||
actual fun getPlatform(): Platform = IOSPlatform()
|
||||
Reference in New Issue
Block a user