[swift-users] OptionSet as Sequence
J.E. Schotsman
jeschot at xs4all.nl
Mon Mar 13 11:51:34 CDT 2017
On 12 Mar 2017, at 23:23, Zhao Xin <owenzx at gmail.com> wrote:
> I don't see the needs to call `for domain in domains` with `domains:OptionSet`. If a parameter want an OptionSet, why not just use`domains` directly instead of `domain`?
You are right, I was writing bad code.
When working with option sets you always end up writing code like
if options.contains(flag1) {...}
if options.contains(flag2) {…}
...
No need for a for-in loop.
Please ignore my posting.
Jan E.
More information about the swift-users
mailing list