swift - Iterating over an NSOrderedSet -
I am trying to repeat on an example of NSOrderedSet something like this: ... However, this compiler error is generated for the loop line: Now I can convert it to an array: . But i hope Wonder what was a better solution? I am also curious to understand why it is not possible to repeat on a set, but there is no order set?
func myFunc () {var ordered ordered = NSOrderedSet (array: [42, 43, 44])
is not a member of 'NSOrderedSet' 'Generator'
respectively set.array {NSLog ("% i", n)}
NSOrderedSet
implies NSFastEnumeration
, so should it work right?
You ordered
order = NSOrderedSet ( Array: [42, 43, 44]) ordered. Set.enumerateObjectsUsingBlock {(elem, idx, stop) -> Update:
Update: as the SWIFT 1.2 (Xcode 6.3), the > NSOrderedSet
correspond to
type sequence
and to ... in ...
:
respectively = NSOrderedSet Array: [42, 43, 44]) for command elem {println (elem)}
Comments
Post a Comment