A Global Singleton is a class of which only one instance exists within a program.

Any attempt to use non-static members of the class involves performing operations on this one instance.




 
 
class SingletonClass {
 
static let sharedInstance = SingletonClass()
 
    ///Override the init method and make it private
    private override init(){
    // User can do additional manipulations here.
    }
}
// Usage
let sharedObject = SingletonClass.sharedInstance
 