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
16.04k stars 1.16k forks source link

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

Closed rustamsmax closed 2 weeks ago

rustamsmax commented 5 months 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 5 months ago

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

rustamsmax commented 5 months 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 5 months ago

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

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

terrakok commented 5 months ago

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

psuzn commented 4 months ago

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

rustamsmax commented 4 months ago

@psuzn supports from kotlin 2.0

okushnikov commented 1 month ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.