Skip to content

Instantly share code, notes, and snippets.

@ohtwo
Last active May 9, 2016 02:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ohtwo/331660e9f2d4d1aabdd234418937676a to your computer and use it in GitHub Desktop.
Save ohtwo/331660e9f2d4d1aabdd234418937676a to your computer and use it in GitHub Desktop.
Lazy Variable without Capturing
lazy var icon: UIImage = { [unowned self] in
guard let iconName = self.iconName, icon = UIImage(named: iconName) else {
return UIImage()
}
return icon
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment