In Kotlin we can compose a Singleton object using
object MySingleton {
// Some static variable.
}
without need to have a class and control its constructor to be private etc.
I try to search if there's equivalent Object
in Swift language I can leverage, or I need to do my own Singleton class instance (e.g. private init()
and static
)?