title: Sort NSFetchedResultsController by closest date ignoring year
body: <p>I am using Core Data with an NSFetchedResultsController to display dates in a table view. Upon fetch I want these date objects sorted by the closest upcoming month/day to today while ignoring the year, preferably (if possible) without having to store the fetched results in an array and being forced to perform a separate sort operation on that array. That's the basic idea, the rest is context.</p>
  
  <p>My NSManagedObject subclass <code>Date</code> has 2 attributes:</p>
  
  <pre><code>Date.date -&gt; 1986-02-06 08:00:00 +0000 // the stored date of type Date
  Date.equalizedDate -&gt; 02/06 // computed from date ignoring year of type String
  </code></pre>
  
  <p>If I use <code>NSSortDescriptor(key: "date", ascending: true)</code> on the fetched results controller, then the dates in the table view are sorted by year (not what I want):</p>
  
  <pre><code>Date.date 1978-06-23 07:00:00 +0000 // 1978 = #1
  Date.date 1986-02-06 08:00:00 +0000 // 1986 = #2
  Date.date 1991-07-26 07:00:00 +0000 // 1991 = #3
  </code></pre>
  
  <p>If I use <code>NSSortDescriptor(key: "equalizedDate", ascending: true)</code> I can get one step closer by ignoring the year and showing proper ascension but it's not compared to today's date:</p>
  
  <pre><code>Date.date 1986-02-06 08:00:00 +0000 // 02/06 = #1 (February 6th)
  Date.date 1978-06-23 07:00:00 +0000 // 06/23 = #2 (June 23rd)
  Date.date 1991-07-26 07:00:00 +0000 // 07/26 = #3 (July 26th)
  </code></pre>
  
  <p>If, for example, today was April 5th, then I would want the fetched results to be fetched and displayed as follows:</p>
  
  <pre><code>                                       // Today is April 5th
  Date.date 1978-06-23 07:00:00 +0000 // 06/23 = #1 (June 23rd)
  Date.date 1991-07-26 07:00:00 +0000 // 07/26 = #2 (July 26th)
  Date.date 1986-02-06 08:00:00 +0000 // 02/06 = #3 (February 6th)
  </code></pre>
  
  <p>Currently, the only way for me to accomplish this is by storing the fetched results controller results in an array, performing a comparison upon the array, and using the array instead of my fetched results controller for the data source of my table view rows and cells:</p>
  
  <pre><code>// fetchedResults = [Date] &lt;- stored Date objects from fetch
  for fetchedDate in fetchedResults {
      // formatDateIntoString changes 2015-10-26 05:43:22 +0000 into 10/26
      if fetchedDate.equalizedDate &lt; NSDate().formatDateIntoString() {
          fetchedResults.removeAtIndex(0)
          fetchedResults.append(fetchedDate)
      } else {
          break
      }
  }
  return fetchedResults
  </code></pre>
  
  <p>I would prefer to omit this extra layer of logic because it not only eliminates the entire purpose of performance of a fetched results controller but it also gives me wonky troubles and wrong index paths when implementing swipe to delete (<a href="https://stackoverflow.com/questions/33338683/nsfetchedresultscontrollerdelegate-animating-deletion-on-wrong-indexpath">link for reference</a>). I know that comparators and selectors don't work for fetched result controllers.</p>
  
  <p>Is there any way to work around this issue?</p>