Skip to content

Instantly share code, notes, and snippets.

@beccadax
Created June 8, 2014 06:49
Show Gist options
  • Save beccadax/97a79e96b57db871ee62 to your computer and use it in GitHub Desktop.
Save beccadax/97a79e96b57db871ee62 to your computer and use it in GitHub Desktop.
Workaround for current lack of stored class variables in Swift.
struct Statics {
static var foo: Int = 0
}
class var foo: Int {
get { return Statics.foo }
set { Statics.foo = newValue }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment