Skip to content

Instantly share code, notes, and snippets.

@ariok
Last active August 29, 2015 14:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ariok/1361e60fa981f189cf75 to your computer and use it in GitHub Desktop.
Save ariok/1361e60fa981f189cf75 to your computer and use it in GitHub Desktop.
[swift]Thread-Safe Singleton implementation
class Manager {
class var sharedManager : Manager {
struct Singleton {
static let instance : Manager = Manager() // let is Thread-safe
}
return Singleton.instance
}
}
// !!! It needs support for @private
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment