1

My goal to create a news feed tableview (in my iOS app using Swift). All items that will be displayed on the news feed are being pulled from my Parse.com database. The problem is that my news feed will contain cells with information from multiple classes in the database. Is it possible to configure a PFQueryTableViewController to display and update based on multiple PFObjects? I haven't been able to find any examples of this online.

I know could create a custom TableView and populate it manually but I'm trying to avoid this if possible :)

Any help/tips are much appreciated! Thank you

rici
  • 234,347
  • 28
  • 237
  • 341
nohalon
  • 25
  • 2
  • This is possible. Are the two classes related by a Relation? For example. Feed Items and Users? – ericgu Mar 11 '15 at 21:42
  • It's actually 3 classes and they aren't related other than the fact that they exist in the same database. – nohalon Mar 11 '15 at 21:44
  • Can you describe those three classes in detail? If I have Class A of NewsFeed Items and each cell populates a newsFeedItem, how do you plan on connecting each newsFeed item to Class B Objects as well as Class C objects? – ericgu Mar 11 '15 at 21:47
  • So I have a class called CheckIn (each row represents a check-in made by a user), a class called CheckOut (each row represents a check-out made by a user), and a class called StatusUpdate. I want my TableView cells to contain all check-ins, check-outs, and posts a given user has access too. So whenever a check-in is added, the table view should update and add a new cell which contains that check-in data, and it should do the same whenever a check-out and status update is made. In parse these three classes are completely separate. The only commonality is that they all contain a "user" column. – nohalon Mar 11 '15 at 21:55
  • First, to answer your original question: you can just add a relational query (https://www.parse.com/docs/ios_guide#queries-relational/iOS) in override func queryForTable() -> PFQuery! {. Second, another friendly suggestion is to see if you can consolidate your data model. To my limited understanding, it seems that you may only need two classes: User Class and Activity Class. CheckIn and CheckOut can be a Boolean or Int Field in this Activity Class. When you create your Query, you can query Activity class with a PFRelation to User to grab any user details. – ericgu Mar 11 '15 at 22:07

0 Answers0