I am trying to get the data from the database in firebase. I want to get the names and store them in an empty array. But the names are being retrieved one by one. how do I put them all in the array at once.
var text = "abc"
var Files = [String]()
var MessageText = ""
let databaseRef = Database.database().reference()
databaseRef.child("Hawalli").queryOrderedByKey().observe(.childAdded, with: {
snapshot in
let snapshotValue = snapshot.value as? NSDictionary
let alerts = snapshotValue?["Name"] as? String
let MessageText = alerts
self.text = MessageText!
print("List of names")
print(MessageText)
})