title: NSSet: return an NSArray of objects sorted by a list of strings on certain property of each object?
body: <p>I have an <code>NSSet</code> of objects.</p>
  
  <p>Each object in the set is an instance of <code>MyObject</code> with a property called <code>name</code>.</p>
  
  <p>I have another <code>NSArray</code> called nameIndexes which contains name values.</p>
  
  <p>I would like to have a function that takes the <code>NSSet</code> and returns a sorted array sorted using the name property based on its position in the nameIndexes array.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Sorry for my misleading, here is an example:</p>
  
  <p>I have a set of MyObject(may not be in the same order):</p>
  
  <pre><code>MyObject1 {name:@"A"}
  
  MyObject2 {name:@"B"}
  
  MyObject3 {name:@"C"}
  </code></pre>
  
  <p>I have another array of names:</p>
  
  <pre><code>{"B", "A", "C"}
  </code></pre>
  
  <p>I want an NSArray of:</p>
  
  <pre><code>{MyObject2, MyObject1, MyObject3}
  </code></pre>