Muaz KADAN
10/24/2024, 2:13 PMMoko-resources has out of box implementation function for read text files from common code - readText()
But when I try to access readText()
I can't find it
am I missing something ?alex009
10/25/2024, 4:25 AMMuaz KADAN
10/25/2024, 6:14 AMval jsonString = Res.readBytes("files/articles.json").decodeToString()
but compose resources doesn't include the resources into the XCframeworkalex009
10/25/2024, 6:52 AMMuaz KADAN
10/25/2024, 6:52 AM// commonMain
expect object FileReader {
fun readText(file: FileResource): String
}
// androidMain
actual object FileReader {
lateinit var context: Context
actual fun readText(file: FileResource): String {
return file.readText(context)
}
}
// iOSMain
actual object FileReader {
actual fun readText(file: FileResource): String {
return file.readText()
}
}
Muaz KADAN
10/25/2024, 6:54 AMApplication
class I added
FileReader.context = this
to onCreate 🫠