Created
August 30, 2014 16:08
-
-
Save licvido/e6cb40763aac76093ad0 to your computer and use it in GitHub Desktop.
SWIFT: Singleton design pattern
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 MyClass | |
{ | |
class var sharedInstance: MyClass { | |
struct Static { | |
static let instance: MyClass = MyClass() | |
} | |
return Static.instance | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment