swift - Ordering by object.count in PFQueryTableViewController -


i need query objects in class , order them frequency of each object in swift. i'm getting query using...

// define query provide data table view     override func queryfortable() -> pfquery{         var query = pfquery(classname: "upvotes")         return query     } 

...but can't seem retrieve objects.count item since can't use async completion block findobjectsinbackground call. should handle in cellforrowatindexpath()?

but can this:

class demo: uiviewcontroller {      var parseobjects: nsarray!      override func viewdidload() {     }      // define query provide data table view      func yourquery() -> pfquery {         var query = pfquery(classname: "upvotes")          query.findobjectsinbackgroundwithblock {             (objects: [anyobject]?, error: nserror?) -> void in              if error == nil {                 if (objects!.count > 0) {                     parseobjects = objects //store objects in variable                 }              } else {                 // log details of failure                 println("error: \(error) \(error!.userinfo!)")             }         }     } } 

and after in tableviewdelegate use parseobjects variable...


Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -