Dan*_*iel 8 warnings dictionary functional-programming swift xcode7
我想删除我的标签的所有子视图,如下所示:
label.subviews.map { $0.removeFromSuperview() }
Run Code Online (Sandbox Code Playgroud)
这曾经在 Xcode 6 中工作。但在 Xcode 7 中我收到以下警告:
调用“map”的结果未使用
这个警告没有意义。我怎样才能压制它?
更新:我通过执行以下操作使其工作,但是,我想保持函数式编程风格并坚持使用 map { }。这也应该有效。
label.subviews.forEach { $0.removeFromSuperview() }
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4313 次 |
| 最近记录: |