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
Post a Comment