これは根本的に「解決策」があるという質問ではありませんが、このコードがはるかに大きくスケーリングされたときにメモリの問題を引き起こすかどうかは疑問でした。子をチェックするとスケーラビリティが低下しますか?
ref.child("Teams").observeSingleEvent(of: .value, with: { (snapshot) in
if snapshot.hasChild(self.teamName.text!){
//Sets the a single team's values
} else {
//Displays a missing team alert
let alert = UIAlertController(title: "Error" , message: "Team does not exist", preferredStyle: .alert)
let actio1n = UIAlertAction(title: "Ok" , style: .cancel , handler: nil)
alert.addAction(actio1n)
self.present(alert, animated: true, completion: nil)
}
})
私はFirebaseがちょうど表面レベル(個々のチームのID)を読み込むかどうか、それはで、深さよりロードした場合に不思議の一種です。あなたの考えは?