ios - Firebase DB Key, Name, Value clarification -


i have firebase db follows:

{   "kids" : {     "icon" : "childicon",     "name" : "children's",     "qty" : 2   },   "clothes" : {     "icon" : "mensicon",     "name" : "mens",     "qty" : 12   },   "womans" : {     "icon" : "womansicon",     "name" : "womans",     "qty" : 5   } } 

i want read top level list of names. example, trying retrieve "kids, clothes, womans"

i can use code:

        let query = ref.queryordered(bychild: "name")   //userid)     query.observe(.value, with: { snapshot in         var array = [categories]()         child in snapshot.children {             if let category = mapper<categories>().map(json: (child as! firdatasnapshot).value as! [string : anyobject]) {                 array.append(category)             }         }         success(array)     }) 

to retrieve of items 'name' field, how retrieve string name of above level.

that code return "children's, mens, womans", want "kids, clothes, womans"

any appreciated. doing in swift, accepted!!

thanks


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

.net - Generate assembly with Roslyn -

batch file - filebot superstrict script: need tiny video sample or other solution -