Guest User

Untitled

a guest
Dec 11th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. self.chatsRef = ref.child("ABC").child(xyz)
  2.  
  3. self.chatsRef.queryLimited(toLast: 100).observe(.value, with: { snapshot in
  4. self.data.removeAll()
  5.  
  6. self.hideProgressHUD()
  7.  
  8. for item in snapshot.children {
  9. if let child = item as? DataSnapshot {
  10. if let dict = child.value as? NSDictionary {
  11. self.shouldAdd = true
  12.  
  13. // filter our flagged messages
  14. // set shouldAdd to false if flagged
  15.  
  16. // filter our blocked users
  17. // set shouldAdd to false if blocked user
  18.  
  19. // only add if appropriate
  20. if self.shouldAdd {
  21. self.messageData.append(dict)
  22. }
  23. }
  24. }
  25.  
  26.  
  27. // reload the tableview
  28. DispatchQueue.main.async {
  29. self.refreshControl.endRefreshing()
  30. self.chatRoomTableView.reloadData()
  31. }
  32. }
  33. })
Add Comment
Please, Sign In to add comment