Sharing my experience as painfully not aware of ho...
# multiplatform
j
Sharing my experience as painfully not aware of how jetbrains compose components resources setup needed to make it work. Need to add this into sourceFolders of Android:
Copy code
sourceSets["main"].apply {
        manifest.srcFile("src/androidMain/AndroidManifest.xml")
        res.srcDirs("src/androidMain/res", "src/commonMain/resources")
        resources.srcDirs("src/commonMain/resources")
    }
IF you want both font and images, need to having root folder to resources, but for Android specifics need to have a font folder inside resources and all files being snake case. Also need to add
Copy code
implementation(compose.components.resources)
into both commonMain, iosMain and androidMain and other platforms. As of example needed to provide actual vs expect for iOS and Android return Font. Not entirely sure if I got it right for iOS yet, but on Android it works by using:
Copy code
@SuppressLint("DiscouragedApi")
@Composable
actual fun font(name: String, res: String, weight: FontWeight, style: FontStyle): Font {
    val context = LocalContext.current
    val id = context.resources.getIdentifier(res, "font", context.packageName)
    return remember(context) {
        Font(id, weight, style)
    }
}
👀 1