Last active
August 29, 2015 14:04
-
-
Save Tron5000/74d3b46dcc93fe12e718 to your computer and use it in GitHub Desktop.
Singleton Pattern in Swift < v1.2
This file contains hidden or 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 Singleton { | |
| class var sharedInstance : Singleton { | |
| struct Static { | |
| static let instance : Singleton = Singleton() | |
| } | |
| return Static.instance | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment