title: Sort Two Arrays of Different Types into One
body: <p>I have two arrays, they are of two different objects, and both contain an ID field. What I need to do is display them in order in a table view controller. They share the same basic info, Size and ID, and those are the only pieces of data displayed, in addition to the type of object it is. When the user selects a cell then it moves to a new view that displays the finer details of the object.</p>
  
  <p>Right now, I have two sections in the table, one for TypeA, and the other for TypeB. They sort through all of the items in their respective list, but are out of order for when the item was made. So it looks like:</p>
  
  <pre><code>TypeA
    ID 1
    ID 2
    ID 5
    ID 6
  TypeB
    ID 3
    ID 4
    ID 7
  </code></pre>
  
  <p>What I need is for it to sort them all into 1 section, and still open the detail view when selected.</p>
  
  <p><strong>Thoughts</strong></p>
  
  <p>I could put them all into an AnyObject dictionary and when looking at individual items determine if they are of one object type or the other. I feel like that would work, but how would I go about sorting that correctly?</p>