moko-resources icon indicating copy to clipboard operation
moko-resources copied to clipboard

Compilation error on iOS with K2

Open bwalter opened this issue 2 years ago • 1 comments

The generated classes do not compile on iOS with the K2 compiler due to a change related to expected/actual objects.

Generated MR.kt:

public expect object MR {
  public object strings : ResourceContainer<StringResource>
  public object plurals : ResourceContainer<PluralsResource>
  public object images : ResourceContainer<ImageResource>
  public object fonts : ResourceContainer<FontResource>
  public object files : ResourceContainer<FileResource>
  public object colors : ResourceContainer<ColorResource>
  public object assets : ResourceContainer<AssetResource>
}

Issue:

Object MR.strings is not abstract and does not implement abstract member nsBundle

bwalter avatar Nov 06 '23 17:11 bwalter

Relevant Kotlin issue: https://youtrack.jetbrains.com/issue/KT-59739

zacharee avatar Nov 18 '23 00:11 zacharee

Hi @Alex009 Whenv0.25.0could be available to public use?

sureshmaidaragi1919 avatar Mar 11 '24 04:03 sureshmaidaragi1919

@sureshmaidaragi1919 i think you tell about 0.24.0. this version already available public as alpha version. in 0.24.0 version will be provided support of K2 too. now it in tests and fixes by @ExNDY , please watch on new releases

Alex009 avatar Mar 11 '24 05:03 Alex009

@Alex009 Yes I am using the 0.24.0-alpha-5 Still I am seeing below issue, Is it not support Kotlin 2.0.0-Beta ? https://kotlinlang.slack.com/archives/CMC5LN42W/p1710063864560009

I have recently updated the KMM jetpack compose to v1.6.0-rc03 and multiplatform 2.0.0-Beta4 and tried running iOS building started seeing this issue for Strings, image, font error: Object 'MR.images' is not abstract and does not implement abstract member 'nsBundle'. error: Object 'MR.strings' is not abstract and does not implement abstract member 'nsBundle'. error: Object 'MR.colors' is not abstract and does not implement abstract member 'nsBundle'. error: Object 'MR.fonts' is not abstract and does not implement abstract member 'nsBundle'.

sureshmaidaragi1919 avatar Mar 11 '24 06:03 sureshmaidaragi1919

On current time, support of K2 in progress. Main problem is changed expect/acutal in Kotlin 2.0

ExNDY avatar Mar 11 '24 06:03 ExNDY

Any timeline to get moko resources supports for Kotlin2.0?

Main problem is changed expect/acutal in Kotlin 2.0

sureshmaidaragi1919 avatar Mar 11 '24 06:03 sureshmaidaragi1919

will be fixed in 0.24.0-alpha6

ExNDY avatar Apr 12 '24 23:04 ExNDY

fixed in 0.24.0-beta-1

Alex009 avatar Apr 19 '24 14:04 Alex009