Skip to content

Instantly share code, notes, and snippets.

@sleroux
Created May 21, 2015 17:55
Show Gist options
  • Save sleroux/eb82bbbfb41e92747b09 to your computer and use it in GitHub Desktop.
Save sleroux/eb82bbbfb41e92747b09 to your computer and use it in GitHub Desktop.
To be lazy or not to be...
lazy var myLabel: UILabel = {
var temporaryLabel : UILabel = UILabel()
return temporaryLabel
}()
let testLabel: UILabel {
if !_testLabel {
_testLabel = UILabel()
}
return _testLabel!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment