https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
b

Boris Yordanov

09/11/2021, 9:12 AM
Anyone using moko -resources for colors with compose/swiftui? Their colour resource does not have resourceID, similarly to how we get strings - MR.strings.my_atring.resourceId
w

wbertan

09/11/2021, 9:16 AM
🤔 They should have
.color
and if I’m not mistake a
.color.uicolor
(for the Swift side)
b

Boris Yordanov

09/11/2021, 9:22 AM
yeah but on the android side that is of type moko.graphics, which doesn't really work. Anyways i found a way -
Copy code
color = Color(MR.colors.apple.color.rgba)
w

wbertan

09/11/2021, 9:25 AM
Okay, in Android should have the
Copy code
.colorInt()
Not sure with Compose.
It is an extension from MokoResources:
Copy code
@ColorInt
fun Color.colorInt(): Int {
    return argb.toInt()
}
221 Views