https://kotlinlang.org logo
#getting-started
Title
# getting-started
d

Daeyoung Kim

03/05/2022, 7:50 AM
I don’t know what was wrong. Anybody can explain this error?
🧵 2
s

Sam

03/05/2022, 7:53 AM
Is this multiplatform code? I think you can only use
synchronized
on JVM
d

Daeyoung Kim

03/05/2022, 7:56 AM
aha~ kmm, You mean its target platform is not JVM.
Am I right?
it seems that KMM its target platform is Kotlin/Native
a

Alexander Maryanovsky

03/05/2022, 9:31 AM
Also, you don't need to do this to create a singleton in Kotlin.
💯 1
t

Tom Hermann

03/05/2022, 2:22 PM
This is the idiomatic way to declare a singleton in Kotlin: https://kotlinlang.org/docs/object-declarations.html#object-declarations-overview
d

Daeyoung Kim

03/06/2022, 12:09 AM
I need to control singleton creation point & its constructor params
p

phldavies

03/06/2022, 7:02 PM
You could still use a singleton object but with a lazy property or lateinit var
2 Views