Join Slack
Powered by
Is there a way to define a IntDef in Kotlin?
# android
d
Daniel
04/12/2018, 6:42 PM
Is there a way to define a IntDef in Kotlin?
g
gildor
04/13/2018, 1:31 AM
Sure, the same as for Java, the only difference you cannot keep constants inside of annotation body (will be available on Kotlin 1.3)
gildor
04/13/2018, 1:33 AM
https://youtrack.jetbrains.com/issue/KT-16962
d
Daniel
04/13/2018, 1:52 PM
Thank you and looking forward to 1.3!
g
gildor
04/13/2018, 2:13 PM
But again, it's possible to define IntDef annotation even now
r
radityagumay
04/15/2018, 3:46 PM
@Daniel
I am using object for that currently.
d
Daniel
04/16/2018, 4:45 PM
@radityagumay
Thank you for your reply! Can you elaborate a bit on your solution?
r
radityagumay
10/11/2018, 5:11 AM
object Foo { const val number = 3 }
@Daniel
73
Views
Open in Slack
Previous
Next