Additional UITableView + InstantSearch HitsTableView

hi, Algolia friends—

I’m looking to implement an additional UITableView within the same UIViewController as a HitsTableViewController using InstantSearch.

The issue I’m running into is this: In having my UIViewController conform to the HitsTableViewController protocol, I’m unable to override the numberOfRowsInSection method, which I assume HitsTableViewController abstracts away and manages. The result is that my additional UITableView displays no rows/cells.

I tried poking around the framework to make the numberOfRowsInSection method open (the framework ships with the method set to public) so that I can override it in my ViewController, but this doesn’t do anything to help my additional UITableView, and seems to break InstantSearch anyway.

Any insight or leads would be tremendously appreciated. Thanks in advance!

EDIT: I see that I can access the numberOfRows property of an additional UITableView. However, this does not actually make any cells populate when defined.

Hi @corey,

Thanks for contacting us! We’re working on a better documentation and improving the apis to deal with such common cases.

Now in order to solve your problem, you have 2 solutions depending on what you’re trying to achieve:

If you’re still dealing with only 1 index, then checkout the ViewController Composition section in here. It shows you how you can avoid inheriting from HitsTableViewController and be able to create multiple hitsTableView along with their hitsController.

If you’re dealing with multiple indices, then checkout this guide on displaying data from multiple hits.

Let me know if you can’t figure out how to make it work, and I’ll try to help you further.