ios - Getting all data in a Firebase column -


i created json database tree , can read specific values these codes. can see on table view "albert einstein"

ref.child("personel").child("name").observesingleevent(of: .value, with: { (snapshot) in              if let item = snapshot.value as? string{                  self.mylist.append(item)                 self.lessonstableview.reloaddata()             }          }) 

https://i.hizliresim.com/jlnebj.png

but, want see categories under personal column? this,

https://i.hizliresim.com/9dappo.png

is there way or learn columns under "personal"

table view output must -> age, name, photo

you can iterate on snapshot, it's children , childrens keys

say have users node user

users   user_0     fav_game: "wow"     name: "leroy" 

then keys of name: , fav_game:

let userref = self.ref.child("users").child("user_0") userref.observesingleevent(of: .value, with: { snapshot in     child in snapshot.children {         let snap = child as! datasnapshot         let key = snap.key         print(key)     } }) 

prints

fav_game name 

an important note is

for child in snapshot.children 

because keep data (keys in case) in order. if snapshot dumped dictionary looses order.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -