Created
July 9, 2019 03:17
-
-
Save fitsyu/63a18f4cb79a0a0e27dd10770c1b1385 to your computer and use it in GitHub Desktop.
Quickly generate swift object singleton
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
// 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