简体   繁体   中英

Swift how to delete childs value which is an Dictionary

i try to delete a childs value in my document to delete. The value is an Dictionary and i need to delete the whole Dictionary but XCode says :

Cannot convert value of type 'Dictionary' to expected argument type '[Any]'

Here is my Code:

var lists = [Dictionary<String, String>
             let washingtonRef = db.collection("Users").document(userid!)
             washingtonRef.updateData([
             "shoppingLists":
             FieldValue.arrayRemove(self.lists[sender.tag] as!
                 Dictionary<String,
                 String>)])

I solved it using this code:

 let washingtonRef = db.collection("Users").document(userid!)

        // Atomically add a new region to the "regions" array field.
        washingtonRef.updateData([
            "shoppingLists": FieldValue.arrayRemove([self.filteredData[sender.tag] as! Any])

            ])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM