Alternative proposal to the above based on @Chris Lee’s point:
Copy code
expect value class ViewNode
actual value class ViewNode(val android: View) // android
actual value class ViewNode(val web: HTMLElement) // web
actual value class ViewNode(val ios: UIView) // ios
To be clear, this doesn't currently work, but it would be nice if it did.
y
Youssef Shoaib [MOD]
07/31/2025, 4:14 PM
Can't you do
expect class
and actualize it with `value class`es?
j
joseph_ivie
07/31/2025, 4:16 PM
"The following declaration is incompatible because modifiers are different"
😲 1
z
zt
07/31/2025, 6:47 PM
I've worked around this by making something like this
Copy code
expect class Something
expect value class Container(val value: Something)
Copy code
actual typealias Something = Int
actual value class Container(val something: Something)
But it would be a lot neater to not have to use a typealias