Skip to content

Instantly share code, notes, and snippets.

@Tylerc230
Created November 20, 2017 23:36
Show Gist options
  • Save Tylerc230/8d6df9c4b12d9087231ee8c5f54d8435 to your computer and use it in GitHub Desktop.
Save Tylerc230/8d6df9c4b12d9087231ee8c5f54d8435 to your computer and use it in GitHub Desktop.
- (id)tableView:(UITableView*)tableView objectAtIndexPath:(NSIndexPath*)indexPath
{
if (indexPath.section == TAPSearchDataSourceSectionTopTalkers) {
if ((indexPath.row == [tableView numberOfRowsInSection:0] - 1) && self.shouldShowAutocompleteTalker && [self autocompletedTalker]) {
return self.autocompletedTalker;
} else if (!self.topTalkers.count || indexPath.row > self.topTalkers.count - 1) {
return self.searchService.serverSearchResultsForTalkers[indexPath.row - self.topTalkers.count];
}
return self.topTalkers[indexPath.row];
} else if (indexPath.section == TAPSearchDataSourceSectionTopConversations) {
if (!self.topConversations.count || indexPath.row > self.topConversations.count - 1) {
return self.searchService.serverSearchResultsForConversations[indexPath.row - self.topConversations.count]; <- crash here
}
return self.topConversations[indexPath.row];
} else if (indexPath.section == TAPSearchDataSourceSectionMoreTalkers) {
return self.moreTalkers[indexPath.row];
} else if (indexPath.section == TAPSearchDataSourceSectionMoreConversations) {
return self.moreConversations[indexPath.row];
} else if (indexPath.section == TAPSearchDataSourceSectionServerResult) {
if (self.searchService.serverSearchResultsForTalkers.count > 0) {
return self.searchService.serverSearchResultsForTalkers[indexPath.row + self.numberOfServerTalkerToCompleteLocalTalkers];
}
return self.searchService.serverSearchResultsForConversations[indexPath.row + self.numberOfServerConversationToCompleteLocalConversations];
}
return nil;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment