I have table view, that have data like "from,To, Action, Date and description". now I'm getting the date as string format and I need to sort the messages by date from latest date to earlier date, I tried sort code but it sort just first two characters. for ex: tSFDATE have strings "11/01/2010", "01/02/2010". the result will be
"01/02/2010", "11/01/2010". so any solution to sort TrackObj by date
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {let cell = tableView.dequeueReusableCell(withIdentifier: "myCell", for: indexPath) as! TrackingTableViewCell
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "dd/MM/yyyy - hh:mm:ss"
let sortedArray = self.trackingListArr.sorted { dateFormatter.date(from: $0.tSFDATE!)! < dateFormatter.date(from: $1.tSFDATE!)! }
let trackObj = sortedArray[indexPath.row]
cell.lblFromValue.text = trackObj.fROMUSERAR!
cell.lblToValue.text = trackObj.tOUSERAR!
cell.lblPurpsValue.text = trackObj.tSFPURPOSEAR!
cell.lblDateValue.text = trackObj.tSFDATE!
cell.lblNoteValue.text = trackObj.tSFDESCRIPTION!
return (cell)
}

yyyy MM dd(firstyearthenmonththenday). If this is not possible you have to convert the date string toDate.