swift - Iterating over an NSOrderedSet -


I am trying to repeat on an example of NSOrderedSet something like this:

  func myFunc () {var ordered ordered = NSOrderedSet (array: [42, 43, 44])  

... However, this compiler error is generated for the loop line:

  is not a member of 'NSOrderedSet' 'Generator'  

Now I can convert it to an array:

  respectively set.array {NSLog ("% i", n)}  

. 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? 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

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -