I have saved a few dates in my sqlite table and they are stored as strings. For example: Oct 4, 2018
. How can I sort it so the newest is at the top? This is how I get the date:
func getData() {
do {
let wos = try self.database.prepare(self.woTable)
for wo in wos {
print("userId: \(wo[self.id]), date: \(wo[self.date])")
if !mywos.contains("\(wo[self.date])") {
mywos.append(workout[self.date])
print(mywos)
tableView.reloadData()
}
}
} catch {
print(error)
}
}