带块的工厂方法
internal func Init<Type>(value : Type, block: @noescape (object: Type) -> Void) -> Type
{
block(object: value)
return value
}
用法:
Init(UILabel(frame: CGRect.zero)) {
$0.backgroundColor = UIColor.blackColor()
}
internal func Init<Type>(value : Type, block: @noescape (object: Type) -> Void) -> Type
{
block(object: value)
return value
}
用法:
Init(UILabel(frame: CGRect.zero)) {
$0.backgroundColor = UIColor.blackColor()
}