Closed SongOnWater closed 1 year ago
compose-resources
folder is an implementation detail, and it isn't supposed to be accessed via UIKit resource API. It is designed in a way that it should be accessed only via Compose resource API (org.jetbrains.compose.resources.resource
).
What is the use case where we need to access it directly?
@igordmn The iOS sample project of components/resources/iosApp reports error "org.jetbrains.compose.resources.MissingResourceException: Missing resource with path: dir/vector.xml". I think that intermedia path "compose-resources" is the root cause.
@SongOnWater If you use implementation(compose.components.resources)
("org.jetbrains.compose.components:components-resources") of the same version as Compose Multiplatform Gradle plugin then it should not be a root cause, because the resource library of 1.5 version prepends all resource paths with "compose-resources" itself.
As @pjBooms mentioned, you need to use implementation(compose.components.resources)
. Also, see the template, it uses org.jetbrains.compose.resources.painterResource to load a resource from shared/src/commonMain/resources
.
If the issue is still present, please provide a project where it is reproducible.
As you mentioned MissingResourceException
and UIKitResourceImpl
, you already use the resource library, but it seems it is an older version (maybe it comes from some library).
To use a valid version, you should add it explicitly
Let us know, if adding it explicitly helps.
Yes I use the library by "implementation(compose.components.resources)" and the version is as below
val kotlinVersion = "1.9.10" kotlin("multiplatform").version(kotlinVersion).apply(false) id("org.jetbrains.compose").version("1.5.1").apply(false)
To bypass this issue , I add a middle path "compose-resources" under my resources root path for iOS
Is it possible to provide a project with the issue? Adding the path shouldn't be necessary.
Closing, as we didn't reproduce it.
If you have a reproducer, please, attach it here, we will look at it and reopen the issue.
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
Describe the bug Why there is a intermedia path "compose-resources" of UIKitResourceImpl , that makes files should be placed under it then to be read. I think the file path should be consistency of multiple platforms.
Affected platforms Select one of the platforms below: