Hello. In the shared module when I create an objec...
# multiplatform
a
Hello. In the shared module when I create an object, like ..
object MyObject{ ... }
when it'll create the obj-c code it'll have an
init()
method apparently, that confuses the iOS developer and she doesn't know if she should instantiate that class or use it as a singleton. With the exception of explicitly naming them using the word xxxSingletonxxx, is there a way I can hide/stop that init() method from being generated ? I can't do a
private constructor()
because it's not a class, it's an object. If I try to instantiate the object in Android it nicely shows an error that the constructor is private, but for iOS ... not so much Ideas ?!
i
https://kotlinlang.org/docs/native-objc-interop.html#kotlin-singletons I believe they should just be using
.shared
if I understand the issue correctly.
a
I think she is, but she can also instantiate that class apparently, and the confusion arises when she doesn't know if she should create her own instance of use
.shared
Besides naming it to be more clear, it would be great to block the possibility of her creating her own instance of it