初學者可以在swift和Firebase中查看!我有一個看起來像這樣一個數據庫:
使用swift檢查Firebase中的usertype
數據庫
球員
ref.authdata.uid換球員-1
ref.authdata.uid換球員-2
ref.authdata.uid換球員-3
教練
ref.authdata.uid換教練1
ref.authdata.uid換教練-2
ref.authdata.uid換教練-3我的應用程序的
一半是專爲球員,一個教練。 如何檢查ref.authData.uid孩子是否在玩家或教練孩子之下?我的數據結構錯誤嗎?
另外,每個uid在它下面都有更多的孩子,我沒有在我的圖表中包含關於每個玩家/教練的信息。以下是我用於初步構建的身份驗證方法。
if ref.authData != nil {
print("There is already a user signed in!")
self.performSegueWithIdentifier("playerLogin", sender: self)
} else {
// No user is signed in
}
感謝您的幫助!
這真棒,這個結構對於我將在這個數據庫中進行的其他一些事情會更好。謝謝Jay!在你提到的關於數據庫的最後一個問題中,「越平坦越好」;我開始明白這是如何派上用場的。 –