[swift-users] OptionSet as Sequence
    J.E. Schotsman 
    jeschot at xs4all.nl
       
    Sun Mar 12 11:09:52 CDT 2017
    
    
  
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.
    
    
More information about the swift-users
mailing list