0

i have tried this code

let newRef = Database.database().reference().root.child("recentlocations").child(Auth.auth().currentUser!.id)

but its return data in ascending order and i want to get data in reverse order means in descending order. So what i have to do for that purpose?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Chetan Hedamba
  • 293
  • 2
  • 9
  • If you are getting data in array than you can reverse array using `array.reversed()` function – Kishan Bhatiya Jan 30 '20 at 12:45
  • i tried that one already but i don't want reverse array, i want get array in descending order from firebase – Chetan Hedamba Jan 30 '20 at 12:47
  • Please check this: https://stackoverflow.com/questions/59887724/firebase-both-query-by-ascending-descending-order – Kishan Bhatiya Jan 30 '20 at 12:51
  • See https://stackoverflow.com/q/36314374, https://stackoverflow.com/q/38757248, and, https://stackoverflow.com/a/45154126, and probably more from this search: https://stackoverflow.com/search?q=%5Bfirebase-realtime-database%5D%5Bswift%5D+query+descending – Frank van Puffelen Jan 30 '20 at 14:06

0 Answers0