devxoul / Then

✨ Super sweet syntactic sugar for Swift initializers
MIT License
4.16k stars 290 forks source link

add @discardableResult #79

Closed biancheng347 closed 4 years ago

biancheng347 commented 4 years ago

_ = UIView().then { $0.tag = 1 }


UIView().then { $0.tag = 1 }

如果是下面的,有很多警告

carlos-chaguendo commented 4 years ago

Use

UIView().do {
$0.tag = 1
}
weixianlove commented 4 years ago

.then 是有返回值的,你不使用返回值,xcode自身会有警告 使用下划线可以忽略 .do 本身就没有返回值,所以不需要返回值的话你可以直接使用.do

devxoul commented 4 years ago

You may use do() instead.