kevinskrei
12/04/2018, 12:53 AMactual fun platformName(): String {
return "Android"
}
import platform.UIKit.UIDevice
actual fun platformName(): String {
return UIDevice.currentDevice.systemName() +
" " +
UIDevice.currentDevice.systemVersion
}
Sam
12/04/2018, 1:17 AMkevinskrei
12/04/2018, 1:35 AMpublic actual class PlatformSettings public constructor(private val delegate: SharedPreferences)
in the android module after declaring expect class PlatformSettings
in the common module. But in mutliplatform-settings he's got the android code in a completely separate module. It's a bit confusing because in the tutorial source code I can access some iOS resources from the same module as the common code using import platform.UIKit....
. I was expecting to be able to do something like import platform.content.Context
from the Android code.
Just wondering how I have to structure the project to be able to access platform specific resources for both iOS and Android while having some common code in betweenrusshwolf
12/04/2018, 4:45 AMsrc/iosMain
and Android stuff from src/androidMain
. For example you could make the Android implementation match iOS a little better by defining actual fun platformName(): String = "Android ${Build.VERSION.RELEASE}"
Sam
12/04/2018, 4:45 AMkevinskrei
12/06/2018, 6:14 PMandroid.Content.Context
and it doesn't appear to find it. Is there something I need to setup to make this work?