Swift fetchRequest with multiple sortDescriptors and Bool filter
<p>I am fetching from core data. I have an attribute that is a bool that is saved with a time attribute. I need to return an array of dates where the bool is true. I cannot get it to work, I either get an array of empty dates or it crashes.</p>

<pre><code>func datesWithCompleteHBI() -&gt; [Date] {

  let managedObjectContext = (UIApplication.shared.delegate as! AppDelegate).managedObjectContext
  fetchRequest.resultType = .dictionaryResultType
  fetchRequest.propertiesToFetch = ["savedTime", "harveyBradshawIndexComplete"]

  let timeSort = NSSortDescriptor(key: "savedTime", ascending: false)
  let hbiSort = NSSortDescriptor(key: "harveyBradshawIndexComplete", ascending: false)
  fetchRequest.sortDescriptors = [timeSort, hbiSort]

  let messageKey = true
  fetchRequest.predicate = NSPredicate(format: "harveyBradshawIndexSaveLevel = %@", messageKey as CVarArg)

  var dates = [Date]()
  do {

      let results = try managedObjectContext.fetch(fetchRequest) as! [[String:Date]]

      dates = results.flatMap { $0["savedTime"]}

     } catch let error as NSError {
       print("Could not fetch \(error), \(error.userInfo)")

    }

 print("hbi date array \(dates)")
 return dates
 }
}
</code></pre>