How to Sort an Array of NSDictionary using DateTime key (Swift 4)?
问题 I have an NSArray of NSDictionary let Array = ( { name = "Auni"; age = "24"; transactionTime = "01-02-2011 12:32:39" }, { name = "Atiqah"; age = "23"; transactionTime = "02-02-2013 10:32:41" }, { name = "Aida"; age = "22"; transactionTime = "04-02-2020 18:32:21"}) How do I sort this array by most recent transactionTime ? Using Swift4. Thank you. Edit: It's easier to have back-end people do it for you. 回答1: You do not need to convert into Date object, dateStrings direct comparison will also