Created
March 25, 2016 11:42
-
-
Save aceontech/09977be5a10835452f2f to your computer and use it in GitHub Desktop.
Improved builder pattern with anonymous closures
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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