app / com.ocean.ishareeconomy_android.utils / ReusableRepositorySingleton

ReusableRepositorySingleton

open class ReusableRepositorySingleton<out T : Any, in A>

Part of utils.

Enables the safe creation of repositories that take arguments in their constructors;

Usage: set the repo's constructor to private and make companion object of ReusableRepositorySingleton to get the singleton instance

Implementation from: https://medium.com/@BladeCoder/kotlin-singletons-with-argument-194ef06edd9e

Author
Christophe Beyls

Constructors

<init>

Part of utils.

ReusableRepositorySingleton(creator: (A) -> T)

Functions

getInstance

Provides the safe singleton instance.

fun getInstance(arg: A): T