[swift-evolution] Proposal: Add function SequenceType.find()

Marco Masser lists at duckcode.com
Thu Feb 18 03:28:01 CST 2016

> On 2016-02-17, at 16:12, Maximilian Hünenberger <m.huenenberger at me.com> wrote:
> I think
>         subviews.find{ ($0 as? NSButton)?.state == NSOnState } as? NSButton
> is sufficient and makes it clear that you are searching for a specific type. Even though you have to cast twice I don't think an additional method would be worth its use since it isn't used as often.

While I very much prefer the version without any casts, I suspect that you’re right in that the consensus will probably be that adding an additional method for heterogenous sequences will be considered not to be worthwhile. But maybe I’m wrong and if not, I can still keep my own implementation.



More information about the swift-evolution mailing list