Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. var user:String = (Auth.auth().currentUser?.email)! // I used email as name of document.
  2.  
  3. var Groups = [String:Any]()
  4.  
  5. let docRef = AppDelegate.db.collection("JoinedGroups").document(user)
  6.  
  7. docRef.getDocument(source: .cache) { (document, error) in
  8. if let document = document {
  9. let dataDescription = document.data()
  10. self.Groups = dataDescription! // unwrapping here
  11. print("Cached document data: (dataDescription)")
  12. } else {
  13. print("Document does not exist in cache")
  14. }
  15. }
  16. // Do any additional setup after loading the view.
  17. print(Groups)
  18.  
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement