Singleton
Also called: Singleton pattern
A class that has exactly one instance, shared by the whole app and reachable through the type itself.
Definition
A singleton hides its constructor and exposes one shared instance: Swift static let shared, a Kotlin object, a Java static final field or enum, a TypeScript module export. One instance is often fine (a logger, an HTTP client, a cache); global access is the risky part, because it hides dependencies and shares state between features and tests. Modern code keeps the single instance and passes it in.
In practice
Analytics.shared.track("purchase") works everywhere, but a view model that receives the analytics object in its constructor can be tested with a fake.