There are several ways to implement the singleton pattern in Swift. With this method, a single instance of the class is created the first time we access the class constant. We will then use the class constant to gain access to this instance throughout the lifetime of the application. We will also create a private initializer that will prevent external code from creating additional instances of the class.
Note that we use the word class in this description and not type. The reason for this is that the singleton pattern can only be implemented with reference types.