SwiftUI Firebase Chat 06: Fetch Current User Firestore

  Рет қаралды 15,646

Lets Build That App

Lets Build That App

2 жыл бұрын

Source:
www.letsbuildthatapp.com/cour...
SwiftUI Core Data:
www.letsbuildthatapp.com/cour...
Maps UIKit Swift:
www.letsbuildthatapp.com/cour...
Fullstack Social NodeJS:
www.letsbuildthatapp.com/cour...
Twitter: / buildthatapp

Пікірлер: 43
@rizibizi4995
@rizibizi4995 2 жыл бұрын
The legend is back! You're the one that taught me how to code in Kotlin and kickstarted my freelancing career. I'm forever grateful!
@SudhanshuSrivastavaIndia
@SudhanshuSrivastavaIndia 2 жыл бұрын
Got to watch you after a long time.. thank Brian :-)
@danielwatson6529
@danielwatson6529 2 жыл бұрын
I love your little error message trick, I've taken it a little further and turned it into an [String] and I append, that way I can see things in chronological order
@Vitsky
@Vitsky 2 жыл бұрын
Спасибо большое за гайды! Очень полезно
@tkweavertom27
@tkweavertom27 Жыл бұрын
Super helpful series!
@clysiasNeves
@clysiasNeves 2 жыл бұрын
Hi Brian, you are a great teacher. thank you. Here is a suggestion to read the user data using the Codable type: struct ChatUser: Codable { var email, profileImageurl, uid: String } private func fetchCurrentUser() { guard let uid = Auth.auth().currentUser?.uid else { self.errorMessage = "Not logged yet" return } Firestore.firestore().collection("users").document(uid).getDocument { document, error in if let error = error { self.errorMessage = (“Failed to fetch current user: \(error.localizedDescription)") return } guard let document = document else { self.errorMessage = "No data found" return } do { self.user = try document.data(as: ChatUser.self) } catch { self.errorMessage = "Decoding process error: \(error) " } } }
@fuadhasan933
@fuadhasan933 2 жыл бұрын
Thanks a lot sir.I have already buy two of your swiftui course which is available in the lbta website.Doing these course with out seeing instructor face is kinda boring.Next time please record all the new swiftui course in the same way u did in AppStore and Instagram course.
@franku3510
@franku3510 2 жыл бұрын
THE MAN THE MYTH THE LEGEND !
@tariqAlmazyad
@tariqAlmazyad 2 жыл бұрын
Hight quality of crafted videos . I hope you include how to share media videos docs voice notes
@dongxiang9370
@dongxiang9370 Жыл бұрын
you are doing great in developing the story of the Tutorial. One suggestion: anyway you can do structure of framework first, then do detailed coding? for example, 1. list all views needed, 2. list all data models needed, 3, list all view models needed, go with sequence of view, models, and view models, or similars. talking a lot of detailed modifiers is good, but focus can be on structure of the project.
@SeriousCat5000
@SeriousCat5000 2 жыл бұрын
I'm fine with no narration for times when its pure layout/UI such as the last video in this series. Though, narration is still helpful for understanding how to use api/packages such as Firebase and for integrating data and view model code within the UI.
@bryinasia
@bryinasia 2 жыл бұрын
Does anybody else have a problem with using the keyboard in the preview? I can't type my email or password in the live preview like he can
@nemoooo5767
@nemoooo5767 2 жыл бұрын
i can't get data from firebase even though i have successfully registered on the same emulator
@robloxiacardriving2868
@robloxiacardriving2868 Жыл бұрын
Long ass url 😂😂😂😂 Keep it up man!
@emielv8365
@emielv8365 2 жыл бұрын
When I try to render the mainmessagesview in the preview, i get an error: Cannot preview in this file - Message send failure for update. Could someone please help me, thanks
@robloxiacardriving2868
@robloxiacardriving2868 Жыл бұрын
I wish I could help you but I don't know
@showerman69
@showerman69 2 жыл бұрын
Brian my boy, I love the narration. Even if it takes more time, I'd prefer less videos with narration than less videos without it
@LetsBuildThatApp
@LetsBuildThatApp 2 жыл бұрын
I see, narration makes the videos longer though. Watching a half hour video can be a daunting task.
@mahmoudfallatah1837
@mahmoudfallatah1837 2 жыл бұрын
how can I use the data from the firebase in other class Like I stored some number and when I get it from the firebase I want to do some calculations on it in other class then I will show it to the user ??
@vr7officiel
@vr7officiel 2 жыл бұрын
can someone help me why i have "Cannot find "fetchCurrentUser" in Scope" pls?
@robloxiacardriving2868
@robloxiacardriving2868 Жыл бұрын
hm sorry can't help I wish I could
@YungCortex
@YungCortex Жыл бұрын
Hey man I’m having this error: every time I type in @ObservedObject private var vm = MessagesViewModel() My whole app crashes?? Any idea why or how to fix ?
@dopedog5316
@dopedog5316 Жыл бұрын
I’m having errors with ChatUser. “Cannot find type ‘ChatUser’ in scope” and “Binary Operator ‘??’ Cannot be applied to operands of type ‘Optional’ and ‘String’” anyone know how to fix these?
@robloxiacardriving2868
@robloxiacardriving2868 Жыл бұрын
Don't know
@robloxiacardriving2868
@robloxiacardriving2868 Жыл бұрын
I wish I could help you
@kimjacobsen3384
@kimjacobsen3384 Жыл бұрын
Hey, first of all thanks for some great videos! I have an little issue at 26:14, with the WebImage. When im typing in the three lines WebImage(url: URL(string: vm.chatUser?.profileImageUrl ?? "")) . resizable(), then I got the following error "Cannot find 'WebImage' in scope. I have imported the SDWebImage because SDWebImageSwiftUI is not available.
@MrAlexCollin
@MrAlexCollin Жыл бұрын
You'll probably need to import the SwiftUI version as shown in the video, if you can't do that, then chances are you may have incorrectly installed something.
@robloxiacardriving2868
@robloxiacardriving2868 Жыл бұрын
@@MrAlexCollin hey bro where's the SDWebImageSwiftUI url Edit: Found it
@ericchu6503
@ericchu6503 8 ай бұрын
The source code link is down, can you put it up again?
@holycaust3763
@holycaust3763 2 жыл бұрын
let number = data["number"] as? String ?? "" Any idea how to edit this so I can be able to fetch an Int ?
@LetsBuildThatApp
@LetsBuildThatApp 2 жыл бұрын
You would just use "as? Int ?? 0" instead.
@LetsBuildThatApp
@LetsBuildThatApp 2 жыл бұрын
I strongly recommend episode 15 on how to use Firestore Codables instead.
@alexeylobankov
@alexeylobankov 2 жыл бұрын
Comment for video trending
@robloxiacardriving2868
@robloxiacardriving2868 Жыл бұрын
please do
@robloxiacardriving2868
@robloxiacardriving2868 Жыл бұрын
26:22
@robloxiacardriving2868
@robloxiacardriving2868 Жыл бұрын
16:20
@seccat
@seccat Жыл бұрын
This advance lesson is on Firebase. So the basic stuff doesn't need to be narrated.
@MosabbirSadman
@MosabbirSadman Жыл бұрын
Hey Everyone! You can simply use the new AsynImage in iOS15 with the (url, content, placeholder) completion instead of SDWebImage. You do not need any package dependencies for that! *****Code given below***** AsyncImage(url: URL(string: vm.chatUser?.profileImageUrl ?? "")) { returnedImage in returnedImage .resizable() .scaledToFill() .frame(width: 50, height: 50) .clipped() .cornerRadius(50) .overlay(RoundedRectangle(cornerRadius: 44) .stroke(Color(.label), lineWidth: 1) ) .shadow(radius: 5) } placeholder: { ProgressView() }
@robloxiacardriving2868
@robloxiacardriving2868 Жыл бұрын
where to put
@aw98584
@aw98584 Жыл бұрын
Hi Brian, I'm having some trouble with this piece of code. FirebaseManager.shared.firestore.collection("users").document(uid).getDocument { snapshot, error in if let error = error { self.errorMessage = "Failed to fetch current user: \(error)" print("Failed to fetch current user:", error) return } For the FirebaseManager line, it keeps saying FirebaseManager has no member firestore. I tried copying the code from the website and the no member firestore error still appears. I've imported FirebaseFirestore and FirebaseFirestore Swift. I am currently on xcode 14.1. Could you please guide me on what to do? Appreciate the videos!
@ayt_daily
@ayt_daily 9 ай бұрын
tips: use .components(separatedBy: "@").first instead .replacingOccurrences
@dongxiang9370
@dongxiang9370 Жыл бұрын
can use this to get the short name: let shortName = email.components(separatedBy: "@").first as? String ?? ""
SwiftUI Firebase Chat 07: Sign Out of Firebase
26:13
Lets Build That App
Рет қаралды 9 М.
SwiftUI Firebase Chat 12: Fetch Messages Documents with Snapshot Listener
29:31
World’s Deadliest Obstacle Course!
28:25
MrBeast
Рет қаралды 151 МЛН
Tom & Jerry !! 😂😂
00:59
Tibo InShape
Рет қаралды 61 МЛН
버블티로 체감되는 요즘 물가
00:16
진영민yeongmin
Рет қаралды 97 МЛН
SwiftUI Firebase Chat 11: Send and Save Messages to Firestore
29:31
Lets Build That App
Рет қаралды 9 М.
Firebase explained in 60 seconds
0:38
Your Average Tech Bro
Рет қаралды 27 М.
SwiftUI Firebase Chat 14: Save and Fetch Recent Messages
41:44
Lets Build That App
Рет қаралды 7 М.
SwiftUI Firebase Chat 08: Show All Users for Creating Message
28:53
Lets Build That App
Рет қаралды 9 М.
How to Setup Firestore database for your SwiftUI app (2021)
26:32
CodeWithChris
Рет қаралды 25 М.
Firebase in 100 Seconds
2:35
Fireship
Рет қаралды 663 М.
SwiftUI Firebase Chat 02: Signing in with Firebase Auth
27:34
Lets Build That App
Рет қаралды 24 М.
SwiftUI Firebase Chat 04: Installing Firestore and Saving User Data Collection
18:08
World’s Deadliest Obstacle Course!
28:25
MrBeast
Рет қаралды 151 МЛН