JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.17k stars 1.11k forks source link

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

Open rustamsmax opened 1 month ago

rustamsmax commented 1 month ago

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
terrakok commented 1 month ago

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

rustamsmax commented 1 month ago

@terrakok couldn't access inner property ResA.string

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

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

rustamsmax commented 1 month ago

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

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

terrakok commented 1 month ago

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

psuzn commented 1 month ago

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

rustamsmax commented 1 month ago

@psuzn supports from kotlin 2.0