You use singletons to provide a globally accessible, shared instance of a class. This definition is not unique to Apple's documentation. The Wikipedia article I linked above also states that “An implementation of the singleton pattern must provide global access to that instance.”
Why singleton is used in Swift?
Singleton is a creational design pattern, which ensures that only one object of its kind exists and provides a single point of access to it for any other code. Singleton has almost the same pros and cons as global variables. Although they're super-handy, they break the modularity of your code.
When should you not use a singleton?
The only situation in which you should consider a singleton is when having more than one instance of already global data would actually be a logical or hardware access error.
...
Related Links:
...
Related Links:
- Brittleness invoked by Global State and Singletons.
- Dependency Injection to Avoid Singletons.
- Factories and Singletons.