HomeiOS Developmentios - The best way to fetch consumer knowledge from firestore

ios – The best way to fetch consumer knowledge from firestore


I’m making an attempt to fetch my consumer knowledge from firebase however I’m recieving this error

Can not discover ‘fetchUser’ in scope

However fetchUser is clearly listed why am I receiving this error

class AuthViewModel: ObservableObject {
    @Printed var userSession: FirebaseAuth.Person?
    
    static let shared = AuthViewModel()
    
 init() {
        
        userSession = Auth.auth().currentUser
      fetchUser()
    }
     func fetchUser() {
                guard let uid = self.userSession?.uid else { return }
             
                Firestore.firestore().assortment("customers").doc(uid).getDocument { snapshot, _ in
                   guard let dictionary = snapshot?.knowledge() else {return}
                   guard let username = dictionary["username"] as? String else {return}
                   guard let e mail = dictionary["username"] as? String else {return}
                   print("DEBUG: Username is (username)")
                    
                    let consumer = consumer(username: username, e mail: e mail, picture: username, uid: uid)
                   
                   print(consumer.username)
                   print(consumer.e mail)
                }

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments