在SwiftUI中使用Firebase进行用户管理从哪里开始? [英] User management with Firebase in SwiftUI where to start?
问题描述
我试图了解SwiftUI在FireUI中的后端开发,我开发了一个小应用程序,我们可以在其中实际使用Firebase Auth登录.我想在用户首次登录时显示一个弹出窗口,Firebase尚无此功能,所以我想编写一个代码,但从哪里开始?
I'm trying to understand back end development with Firebase in SwiftUI, I have developed a small application in which we can actually login with Firebase Auth. I would like to display a pop-up when the user logs in for the first time, Firebase doesn't have a function already done for that so I would like to code one but where to start?
我想获取用户登录时的UID并将其放入"user_data"数据库(如果还不存在的话),否则将忽略其余的功能.如果不存在,则显示一个弹出窗口,在弹出窗口中,他可以选择将分配给他的标志(例如城市),然后显示其城市中的餐馆.
I wanted to get the UID of the user when he logs in and put it in the "user_data" database if it wasn't already there otherwise ignore the rest of my function. If it is not there then display a pop-up in which he can choose a flag that will be assigned to him (for example a city) and then display the restaurants in his city for example.
这个问题看似愚蠢,但我是该领域的新手,我想改进一下,因为它引起了我的极大兴趣,并希望在swiftUI的后端尽可能多地理解和记录我.
The question may seem silly but I am new to this field and I would like to improve because it interests me a lot and seeks to understand and document me as much as possible on the back end of swiftUI.
感谢您的宝贵帮助和建议.
Thank you for your precious help and advice.
推荐答案
Auth.auth().signIn(with: credential) { (result, error) in
if error == nil{
if result?.additionalUserInfo!.isNewUser == true{
//is a new user
}
}
}
这篇关于在SwiftUI中使用Firebase进行用户管理从哪里开始?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!