ios - Parse - Swift : Concatenate Queries -
i'm creating ios app swift , parse.com. unfortunately, i've problem when build query.
what want : have class sport's players (with goals , passes). retrieve player goals , player passes. have 2 columns in parse class : goals , passes.
so, me, use
query_goals.limit = 1 query_goals.orderbydescending("goals") query_passes.limit = 1 query_passes.orderbydescending("passes")
and need concat 2 queries didn't find in swift ios documentation...
does have idea please ? :)
edit : want print best scorer , passer in collectionview cells :
override func queryforcollection() -> pfquery { let query = pfquery(classname: "liste_joueurs") query.limit = 1 query.orderbydescending("goals") let query_passes = pfquery(classname: "liste_joueurs") query_passes.limit = 1 query.orderbydescending("passes") let final_query = query + query_passes //swift concat illustrate purpose return final_query } override func collectionview(collectionview: uicollectionview, cellforitematindexpath indexpath: nsindexpath, object: pfobject!) -> pfcollectionviewcell? { let cell = collectionview.dequeuereusablecellwithreuseidentifier("statscell", forindexpath: indexpath) as! statsviewcell // first cell best scorer // second cell best passer return cell }
in final_query,
let query = pfquery(classname : "sportsplayers") // im assuming classname change needed // highest scorer query.orderbydescending("goals") query.limit = 1 // highest passes query.orderbydescending("passes") query.limit = 1
Comments
Post a Comment