title: Data model for folders in Core Data
body: <p>I'm trying to implement a folders and items data model in Core Data. It will be displayed in a table view. I'm using a "listItem" entity for the table view with these properties:</p>
  
  <pre><code>listItem
  --------
  isFolder (BOOL)
  item (relationship to an Item)
  folder (relationship to a Folder, if isFolder is true, otherwise nil)
  </code></pre>
  
  <p>My Folder and Item entities both have a name property and a dateCreated property. My Folder entity also has an "listItems" relationship containing more listItems. All listItems are contained in a parent Folder.</p>
  
  <p>How can I ask a fetched results controller to use the name or dateCreated property to order the tableview, even though they are in different relationships? Do I have to make a copy of the name and dateCreated in listItem? Is there a better way to do this in Core Data? Thanks.</p>