Hi all, what is the best approach of the Singleton...
# announcements
s
Hi all, what is the best approach of the Singleton pattern in Kotlin when the creation of the lazy initialized Singleton requires one or more argument? Currently I came up with
Copy code
object MyObjectSingleton {
  private var instance: MyObject? = null

  fun getMyObject(someArg: String): MyObject {
    if (instance == null)
      instance = MyObject(someArg)
    return instance!!
}
Is there any better approach?