Convert NSMutableArray to a NSSet with the same order

ios, nsmutablearray, nsset, objective-c

Solution

If you want order, you'll have to use an NSOrderedSet.

NSOrderedSet *set = [NSOrderedSet orderedSetWithArray:theArray];

Problem

How can I do that programatically? I am told that this is the way to do it but the `NSSet` has a different order. ``` NSSet *set = [NSSet setWithArray:theArray]; ``` Any idea? Thanks in advance.

Original source