Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var testTable = ["active ingredient", "titanium dioxide 3.1 %other ingredients", "aqua", "water", "cyclopentasiloxane", "cyclohexasiloxane dimethicone", "vinyl dimethicone crosspolymer", "methyl trimethicone", "peg-10 dimethicone", "alcohol", "dimethicone"]
- func loadData(){
- for i in 0..<testTable.count {
- let db = Firestore.firestore()
- db.collection("Ingredients").whereField("compName", arrayContains: testTable[i] ).getDocuments(){
- querySnapshot, error in
- if let error = error {
- print("(error.localizedDescription)")
- }else if let querySnapshot = querySnapshot {
- if (querySnapshot.isEmpty == false){
- let res = querySnapshot.documents.compactMap({Ingredients(dictionary: $0.data())})
- self.ingredientsArray.append(contentsOf:res)
- print(self.testTable[i])
- DispatchQueue.main.async {
- self.tableView.reloadData()
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement