From my short experience with iOS8 Swift there are three approaches to implement the Singleton pattern that support lazy initialisation and thread safety. Global constant Nested struct dispatch_once Download the Source Files for example These approaches might change or become redundant as the language matures. Global constant 1234567private let _SingletonSharedInstance = Singleton() class Singleton { class var sharedInstance : Singleton { return _SingletonSharedInstance } } We use a global constant because class ...
↧