ios - NSSortDescriptor NSDate ascending. How to sort objects with the same date? -
i using nsfetchedresultscontroller display objects event in list. event -object has property of startdate , eventtype property enum of types checkin , concert , meeting , flight , checkout . nsfetchedresultscontroller has sortdescriptor orders events startdate : eventsrequest.sortdescriptors = [nssortdescriptor(key: "startdate", ascending: true)] this works fine, however, in cases startdate checkin event , meeting event same. confuses sortdescriptor , places meeting before checkin . is possible make custom nssortdescriptor checks if startdate same, checks eventtype property , returns checkin before meeting ? sortdescriptors array, add additional nssortdescriptor second property wish, that: eventsrequest.sortdescriptors = [nssortdescriptor(key: "startdate", ascending: true), nssortdescriptor(key: "eventtype", ascending: true)] this firstly use nssortdescriptor startdate , if same check value of eventtype