[swift-evolution] Remove forEach?
Brent Royal-Gordon
brent at architechies.com
Tue Dec 8 16:47:53 CST 2015
> As long as the `for` loop is in the language, I don’t really see the use of `forEach`.
Here’s a typical use of forEach for me:
generateABunchOfSubviews().forEach(addSubview)
Seriously. I have one unreleased app which generates an entire software keyboard like that.
You could write it like:
for subview in generateABunchOfSubviews() {
addSubview(subview)
}
But why use the extra lines and temporary variable when you don’t have to?
--
Brent Royal-Gordon
Architechies
More information about the swift-evolution
mailing list