[swift-users] OptionSet as Sequence
Zhao Xin
owenzx at gmail.com
Sun Mar 12 17:23:24 CDT 2017
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`?
Zhaoxin
On Mon, Mar 13, 2017 at 12:09 AM, J.E. Schotsman via swift-users <
swift-users at swift.org> wrote:
> Hello,
>
> Recently I wrote code like this:
>
> let domains:[FileManager.SearchPathDomainMask] = [.userDomainMask,
> .localDomainMask, .networkDomainMask]
> for domain in domains { … }
>
> But I would prefer this:
>
> let domains:FileManager.SearchPathDomainMask = [.userDomainMask,.localDomainMask,
> .networkDomainMask]
> for domain in domains { … }
>
> This requires this OptionSet to conform to Sequence.
> Would it be possible to generically conform all OptionSets with
> RawValue:IntegerArithmetic to Sequence?
> I’ve tried but it seems to be tricky.
>
> Jan E.
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170313/d48fe0dd/attachment.html>
More information about the swift-users
mailing list