mirror of
https://github.com/hmalik144/KotlinMultiplatformWeather.git
synced 2025-12-10 03:05:31 +00:00
Initial commit
This commit is contained in:
5
shared/src/androidMain/kotlin/Dispatcher.kt
Normal file
5
shared/src/androidMain/kotlin/Dispatcher.kt
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.appttude.h_mal.shared
|
||||
|
||||
import kotlinx.coroutines.*
|
||||
|
||||
internal actual val ApplicationDispatcher: CoroutineDispatcher = Dispatchers.Default
|
||||
5
shared/src/androidMain/kotlin/common.kt
Normal file
5
shared/src/androidMain/kotlin/common.kt
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.appttude.h_mal.shared
|
||||
|
||||
actual fun platformName() : String {
|
||||
return "Android"
|
||||
}
|
||||
5
shared/src/commonMain/kotlin/Dispatcher.kt
Normal file
5
shared/src/commonMain/kotlin/Dispatcher.kt
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.appttude.h_mal.shared
|
||||
|
||||
import kotlinx.coroutines.*
|
||||
|
||||
internal expect val ApplicationDispatcher: CoroutineDispatcher
|
||||
7
shared/src/commonMain/kotlin/common.kt
Normal file
7
shared/src/commonMain/kotlin/common.kt
Normal file
@@ -0,0 +1,7 @@
|
||||
package com.appttude.h_mal.shared
|
||||
|
||||
expect fun platformName() : String
|
||||
|
||||
fun createApplicationScreenMessage() : String {
|
||||
return "Kotlin Rocks on ${platformName()}"
|
||||
}
|
||||
16
shared/src/iosMain/kotlin/Dispatcher.kt
Normal file
16
shared/src/iosMain/kotlin/Dispatcher.kt
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.appttude.h_mal.shared
|
||||
|
||||
import kotlinx.coroutines.*
|
||||
import platform.darwin.*
|
||||
|
||||
internal actual val ApplicationDispatcher: CoroutineDispatcher = NsQueueDispatcher(dispatch_get_main_queue())
|
||||
|
||||
internal class NsQueueDispatcher(
|
||||
private val dispatchQueue: dispatch_queue_t
|
||||
) : CoroutineDispatcher() {
|
||||
override fun dispatch(context: CoroutineContext, block: Runnable) {
|
||||
dispatch_async(dispatchQueue) {
|
||||
block.run()
|
||||
}
|
||||
}
|
||||
}
|
||||
8
shared/src/iosMain/kotlin/common.kt
Normal file
8
shared/src/iosMain/kotlin/common.kt
Normal file
@@ -0,0 +1,8 @@
|
||||
package com.appttude.h_mal.shared
|
||||
|
||||
|
||||
import platform.UIKit.UIDevice
|
||||
|
||||
actual fun platformName() : String {
|
||||
return "iOS " + UIDevice.currentDevice.systemVersion
|
||||
}
|
||||
2
shared/src/iosMain/kotlin/dummyFile.kt
Normal file
2
shared/src/iosMain/kotlin/dummyFile.kt
Normal file
@@ -0,0 +1,2 @@
|
||||
// This file is needed because the packForXcode task requires the source code to be present to generate the XCode framework.
|
||||
// Feel free to remove this file as soon as you have created some code in this source set.
|
||||
2
shared/src/main/AndroidManifest.xml
Normal file
2
shared/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="me.h_mal.android"/>
|
||||
Reference in New Issue
Block a user