Skip to content

Instantly share code, notes, and snippets.

@charlesferreira
Created February 24, 2018 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charlesferreira/9619f3fb51364e6fb3ed746bc475f468 to your computer and use it in GitHub Desktop.
Save charlesferreira/9619f3fb51364e6fb3ed746bc475f468 to your computer and use it in GitHub Desktop.
class MySingleton {
static func sharedInstance() -> MySingleton {
struct Static {
static let instance = MySingleton()
}
return Static.instance
}
private init() {}
}
let singleton = MySingleton.sharedInstance()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment