Skip to content

Instantly share code, notes, and snippets.

@fitsyu
Created July 9, 2019 03:17
Show Gist options
  • Save fitsyu/63a18f4cb79a0a0e27dd10770c1b1385 to your computer and use it in GitHub Desktop.
Save fitsyu/63a18f4cb79a0a0e27dd10770c1b1385 to your computer and use it in GitHub Desktop.
Quickly generate swift object singleton
// MARK: Singleton Instance
private init() {}
private static var instance: <#T#>!
static var shared: <#T#> {
if instance == nil {
instance = <#T#>()
}
return instance
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment