Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here

Statistics on YLTableView

Number of watchers on Github 134
Number of open issues 7
Average time to close an issue 6 days
Main language Objective-C
Average time to merge a PR 4 days
Open pull requests 7+
Closed pull requests 3+
Last commit almost 2 years ago
Repo Created over 4 years ago
Repo Last Updated over 1 year ago
Size 680 KB
Organization / Authoryelp
Page Updated
Do you use YLTableView? Leave a review!
View open issues (7)
View YLTableView activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating YLTableView for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

Build Status


YLTableView is a framework for working with UITableView used by a number of the table views inside of the Yelp app. It makes it easy to work with cell models, allows your cells to have child view controllers, and provides a framework for building your own pull-to-refresh header.

To learn more about the goals high-level architecture of YLTableView, check out our blog post.


We recommend using CocoaPods to install YLTableView. To do so, add the following to your Podfile:

pod 'YLTableView', '~> 2.0'

Example usage

You can clone the project and check out the example app to see YLTableView in use.

Cells and Models

All cells should provide an estimated height and take a model. Cells generally expect one specific type of model, while a given model could work with any number of cells. Start by subclassing UITableViewCell and implementing the YLTableViewCell protocol, which requires implementing setModel: and estimatedRowHeight::

@interface YLExampleTextCell : UITableViewCell <YLTableViewCell>

@implementation YLExampleTextCell
- (void)setModel:(NSObject *)model {
  NSAssert([model isKindOfClass:[NSString class]], @"Must use %@ with %@", NSStringFromClass([NSString class]), NSStringFromClass([self class]));
  self.mainTextLabel.text = (NSString *)model;

+ (CGFloat)estimatedRowHeight {
  return 44.0;

This cell expects an NSString as its model, but your cell can use any object you want.

Data Source

To use YLTableView, you should subclass YLTableViewDataSource. After implementing a few simple methods, YLTableViewDataSource takes care of connecting cells to models.

@interface YLExampleTableViewDataSource : YLTableViewDataSource
@property (copy, nonatomic) NSArray *models;

@implementation YLExampleTableViewDataSource
- (instancetype)init {
  if (self = [super init]) {
    _models = @[@"cell one", @"cell two", @"cell three"];
  return self;

#pragma mark YLTableViewDataSource subclass

- (NSString *)tableView:(UITableView *)tableView reuseIdentifierForCellAtIndexPath:(NSIndexPath *)indexPath {
  return NSStringFromClass([YLExampleTextCell class]);

- (NSObject *)tableView:(UITableView *)tableView modelForCellAtIndexPath:(NSIndexPath *)indexPath {
  // The model returned here must work with the cell specified above.
  return self.sectionModels[indexPath.row];

#pragma mark UITableViewDataSource

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  return self.sectionModels.count;

Table View

Finally, you can use a YLTableView to connect everything together.

@interface YLExampleViewController : UIViewController

@implementation YLExampleViewController
- (void)loadView {
  [super loadView];
  YLExampleTableViewDataSource *dataSource = [[YLExampleTableViewDataSource alloc] init];
  YLTableView *tableView = [[YLTableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
  // YLTableViewDataSource has to be the delegate and the dataSource of the table view.
  tableView.dataSource = dataSource;
  tableView.delegate = dataSource;

  // Registering cells and reuse identifiers
  [tableView registerClass:[YLExampleTextCell class] forCellReuseIdentifier:NSStringFromClass([YLExampleTextCell class])];

  self.view = tableView;

Child View Controllers

In order to make your cells more modular, YLTableViewDataSource allows your cells to have child view controllers. Simply have your cell implement the YLTableViewChildViewControllerCell protocol and set the parentViewController property on your data source. YLTableViewDataSource will take care of the rest.

This is great when your cells have multiple buttons or actions that can push on view controllers. For example, the cell below is a UICollectionView owned by a UIViewController, which pushes on larger image views when the user taps on an image.

Images cell

Check out YLExampleImagesCell.m for an example.

Pull to Refresh

YLTableView doesn't include a pull-to-refresh header, but makes it really easy to build your own. Simply subclass YLRefreshHeaderView and implement setRefreshState:animated:. Then you can set the refreshHeader property on YLTableView and add a listener for the UIControlEventValueChanged event on your refresh header.

Check out YLExampleRefreshHeader.m for an example.


Copyright 2016 Yelp, Inc.

Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

YLTableView open issues Ask a question     (View All Issues)
  • over 3 years Unregistering cell classes causes an assertion failure
  • over 4 years Support cell nibs
YLTableView open pull requests (View All Pulls)
  • Added some clarification to readme in case people are using storyboards
  • Document reuse identifiers convention
  • Allow overriding of estimated row height with caching
  • Fixed behavior for scroll views that have a nonzero top UIEdgeInset
  • Allow YLTableViewCell conforming classes to be unregistered
  • Fix Travis build
  • Various Xcode recommended project updates, and update to iOS 9
YLTableView list of languages used
Other projects in Objective-C