Skip to content

Instantly share code, notes, and snippets.

@aceontech
Created March 25, 2016 11:42
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 aceontech/09977be5a10835452f2f to your computer and use it in GitHub Desktop.
Save aceontech/09977be5a10835452f2f to your computer and use it in GitHub Desktop.
Improved builder pattern with anonymous closures
class SomeClass {
var someSubview:UIView = {
let v = UIView()
v.someProperty = "You want to initalize"
v.anotherProperty = "You may want to initialize"
return v
}()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment