使用Swift从Firebase数据库检索

时间:2020-09-07 10:51:33

标签: swift firebase firebase-realtime-database

我正在尝试从Firebase中的数据库获取数据。我想获取名称并将它们存储在一个空数组中。但是名称是一个接一个地检索的。如何将它们全部一次放入数组。

https://docs.microsoft.com/en-us/sql/relational-databases/stored-procedures/specify-parameters

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)
    })

Firebase Database

0 个答案:

没有答案