Closed tallnato closed 4 months ago
Good day.
So far we have intentionally chosen to offer a very flexible API allowing the integration to choose whichever architecture fits their project best.
Very similar to your approach the wasm example loads it for example this way:
val libraries = produceState<Libs?>(null) {
value = withContext(Dispatchers.Default) {
Libs.Builder()
.withJson(Res.readBytes("files/aboutlibraries.json").decodeToString())
.build()
}
}
Your approach is quite similar and also fine. The cleanest would certainly be to pull it out of the compose code, and only expose the state to compose world.
That said, I feel like there might be a good argument to build a new rememberLibraries
API or similar to abstract this logic away. 🤔
Hi there,
I'm trying to add this library to a Kotlin Multiplatform project with Compose Multiplatform, targetting Android and iOS. I'm using also Multiplatform resources, where I store the
aboutlibraries.json
I've started by running the gradle command to generate the
aboutlibraries.json
./gradlew :shared:exportLibraryDefinitions -PaboutLibraries.exportPath=src/commonMain/composeResources/files
Then, on Compose side I did this, but looks very 'hacky'
Ignore the fact that the file is being read in the Composable, it was just for test porposes.
Is there a better way? Thank you so much