Created
June 17, 2014 19:11
-
-
Save veeneck/0aa2c50e08d9f6798e12 to your computer and use it in GitHub Desktop.
Swift Static Var
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
class Flag : SKSpriteNode { | |
struct FlagSingleton { | |
static var texture = SKTexture[]() | |
static var onceToken: dispatch_once_t = 0 | |
} | |
class func loadSharedAssets() { | |
dispatch_once(&FlagSingleton.onceToken, { | |
FlagSingleton.textures.append(SKTexture(imageNamed:"flag_castle")) | |
FlagSingleton.textures.append(SKTexture(imageNamed:"flag_melee")) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment