title: iOS Universal App - UITableView/UICollectionView
body: <p>I'm trying to develop a universal iOS app and ideally I'm trying to get as much code re-use as possible.</p>
  
  <p>I'm using storyboards so the UI is segmented into scenes.</p>
  
  <p>In the iPhone storyboard the particular scene in question is best suited to a table view.
  In the iPad storyboard, the equivalent scene in the storyboard would ideally implement a UICollectionView and so render the content in a grid.</p>
  
  <p>Both views should implement a pull-to-refresh control which in one case is going to call a [UITableView reloadData] and in the other a [UICollectionView reloadData].</p>
  
  <p>Anybody any advice on how to get the maximum amount of code re-use, ie. what does the controller class look like?</p>
  
  <p>1 option would be to have 1 monolithic class that conforms to both the UITableView  protocols and the UICollectionView protocols but this doesn't feel right.</p>
  
  <p>Another option would be to have a base class and then subclass it with specialisations for iPhone and iPad. Whilst this feels cleaner, I'm still thinking there might be a better way. In my first attempt at this it felt like there was more code in the specialisation classes than there was in the base class.</p>
  
  <p>The third plan I've considered is simply to use a UICollectionView in both apps therefore eliminating the complexity of the controller.  Hopefully I could force the layout of the collection view to be a grid on the iPad whilst tell it to mimic a table view on the iPhone.</p>
  
  <p>Whilst on the face of it this sounds easy I'm struggling to make a UICollectionView work exactly like a table view would do normally.</p>
  
  <p>Any advice guys?</p>
  
  <p>Many thanks,</p>
  
  <p>CA.</p>