/JustATableCellFactory

Just a table cell factory. A lightweight, thin, low coupling table cell factory, which aims at providing many different cells with less implementation in the controllers and implementation where it makes sense!

Primary LanguageObjective-C

Just A Table Cell Factory

Just a table cell factory. A lightweight, thin, low coupling table cell factory, which aims at providing highly customised cells with thin setup implementation

######Features

  • Makes the cell responsible for it self (height, layout)
  • No Model <-> cell coupling
  • Reduce ViewController code
  • Easily Integrated into existing code

####1: Get

Soon.

####2: Using There are a few steps to take in order to use JATableCellFactory.
3 steps, total.

  • ######1 Cells Cells need to implement the protocol JACell
    JACell does 3 things:

    • Calculate its Height heightFromObject:(id)object atIndexPath:(NSIndexPath *)indexPath;
    • Update itself updateCellWithObject:(id)object atIndexPath:(NSIndexPath *)indexPath;
    • Tell the factory if it is using a nib nibNameForCellOrNil
    • these are all required.
  • ######2 Mapping provider JAMapping is a simple class with one function

    • Map a Model Class to a cell Class
      mappingFromModelClass:(Class)objectClass toCellClass:(Class)cellClass;
    • It's worth mentioning: NSAssert(NO, @"Cell class NEEDS to be a UITableViewCell Subclass");
    • One more thing; adding the mapping into the factory
      addObjectMapping:(JAMapping *)m
  • ######3 Datasource UITableViewDatasource UITableViewDelegate Here is where the magic happens

    • Cell for row
      return [self.cellFactory cellForObject:anObject atIndexPath:indexPath fromTableView:tableView];
    • Height for row
      Class cellClass = [self.cellFactory cellClassFromObject:modelObject];
      return [cellClass heightFromObject:modelObject atIndexPath:indexPath];

####3: TODO's The project is in no way complete and here are some of the things I plan on doing before 1.0

  • Cocoapods - Integrate this into cocoapods
  • AppleDoc - HTML generated and Xcode integrated appledoc comments
  • View Controller based mapping - Add functionality to easily add/preserve ViewController -> Cell mapping.
  • A Proper Demo - Learn by doing and by looking at what I did.