compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

[Compose resources]: Allow custom naming of "Res" class generated

Open rustamsmax opened this issue 1 month ago • 6 comments

Using compose resources in multi module project we have to give alias when importing Res classes from multiple modules

import package.name.modulea.Res
import package.name.moduleb.Res as ResB
import package.name.modulec.Res as ResC

It would be good enhancement to allow custom names for this class

import package.name.modulea.ResA
import package.name.moduleb.ResB
import package.name.modulec.ResC

rustamsmax avatar May 06 '24 09:05 rustamsmax

Have you tried type aliases? In the modulea: typealias ResA = Res

terrakok avatar May 06 '24 20:05 terrakok

@terrakok couldn't access inner property ResA.string

telegram-cloud-photo-size-2-5316804612482783469-y

telegram-cloud-photo-size-2-5316804612482783468-x

rustamsmax avatar May 07 '24 00:05 rustamsmax

The only solution was to create an extra object and expose properties

telegram-cloud-photo-size-2-5316804612482783472-y

rustamsmax avatar May 07 '24 00:05 rustamsmax

https://youtrack.jetbrains.com/issue/KT-34281 😞

terrakok avatar May 07 '24 10:05 terrakok

I'm curious, multi-module resources are not supported yet, are they? @rustamsmax

psuzn avatar May 18 '24 11:05 psuzn

@psuzn supports from kotlin 2.0

rustamsmax avatar May 18 '24 11:05 rustamsmax