Skip to content

Instantly share code, notes, and snippets.

@sunshinejr
Last active May 20, 2016 23:03
Show Gist options
  • Save sunshinejr/73ac9c8cf70286db3de28b898b19e57c to your computer and use it in GitHub Desktop.
Save sunshinejr/73ac9c8cf70286db3de28b898b19e57c to your computer and use it in GitHub Desktop.
struct LazyType {
// Normal usage
lazy var soomethingLazy: String = {
return "Test lazy instance method"
}()
// Lazy in statics
static var somethingLazy: String = {
return "Test lazy static method"
}()
static var somethingStoredLazy: Int = 12 * 8
static var somethingComputedLazy: Double {
get {
return 12.0 * 98.0
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment