Created
November 4, 2014 09:22
-
-
Save konrad1977/673c77268695e331510d to your computer and use it in GitHub Desktop.
Singleton in Swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Factory { | |
} | |
extension Factory { | |
class var SharedInstance: Factory { | |
struct Static { | |
static let instance: Factory = Factory() | |
} | |
return Static.instance | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment