Factory method with block
suggest changeinternal func Init<Type>(value : Type, block: @noescape (object: Type) -> Void) -> Type
{
block(object: value)
return value
}
Usage:
Init(UILabel(frame: CGRect.zero)) {
$0.backgroundColor = UIColor.blackColor()
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents