title: Conforming to UITableViewDelegate and UITableViewDatasource in Swift?
body: <p>I am learning swift 2.0, and I was wondering if you still need to add the code <code>tableView.datasource = self</code> and <code>tableView.delegate = self</code> like in Obj-C to conform to the protocols?</p>
  
  <p>Example code:</p>
  
  <pre><code>class AboutViewController: UIViewController, UITableViewDataSource,   UITableViewDelegate
  {
      override func viewDidLoad()
      {
          super.viewDidLoad()
  
          // conform to protocols
          aboutTableView.dataSource = self
          aboutTableView.delegate = self
      }
  
      func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int
      {
          return 2
      }
  
      func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -&gt; CGFloat
      {
          return 50
      }
  
      func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell
      {
          // Code here
      }
  }
  </code></pre>
  
  <p>Now the table view loads with the correct data in each cell.</p>
  
  <p>However, if I remove <code>aboutTableView.datasource = self</code> and <code>aboutTableView.delegate = self</code> from <code>viewDidLoad</code>, my table view is blank. Why is this?</p>
  
  <p>Is this code still required because I see many youtube tutorials that does not include this anymore in swift, and I'm confused as to why mine doesn't work without it?</p>