title: iOS - UITableView delegate & datasource in MVP design
body: <p>I am trying to implement <code>UITableViewController</code> using Model-View-Presenter. Since I am new to this concept, I am very confused by how to separate <code>UITableView's</code> data source protocols from <code>UIViewController</code>.</p>
  
  <p>Many articles agree with the idea that View+Viewcontroller needs to be dumb and only consider about UIs and their layouts. 
  On the other hand, Presenter needs to be a facilitator between view and model and also implement logic, but they stated to not include UIKit since it does not directly manipulate UIs. And here is where my confusion kicks in.</p>
  
  <p>When we implement UITableView, we have to implement two protocols: <code>UITableViewDelegate</code> and <code>UITableViewDataSource</code>, especially the data source.</p>
  
  <p>I assume delegate belongs to View portion and passes events to Presenter when receives user action.</p>
  
  <p>However, to implement <code>UITableViewDataSource</code>, we must have some model that table view utilizes. That being said, I can only think of two ways to somehow fit into MVP.</p>
  
  <ol>
  <li><p>Pass Model value to <code>UITableView</code> from Presenter, and let it be read-only valuable in the view for the sake of data source (such as create a row for a specific index). But then I think it violates the MVP concept since the Model value is direct access by View.</p></li>
  <li><p>Let presenter be the data source. But since Presenter should not import UIKit, I think import UIKit and implement UITableViewDatasource also violates the MVP concept.</p></li>
  </ol>
  
  <p>So long story short, I am confused where and how to appropriately implement UITableDatasource... If anyone knows this concept well, please share your knowledge. Thank you in advance!</p>