title: UITableView inside a ViewController with custom cell without storyboard
body: <p>I'm working with Swift 2.0 and Xcode 7.2.</p>
  
  <p>I want to learn how to make an app without a storyboard (UI with pure programming code). To start off, I am trying to make a simple app, with three labels, inside a custom UITableView cell which will be updated dynamically through the internet.</p>
  
  <p>Here is what I have achieved so far: </p>
  
  <ul>
  <li>Created a new Swift project and deleted the main.storyboard from the project</li>
  <li>Added a view controller as the <code>rootViewController</code> in <code>AppDelegate</code></li>
  <li>Included code to create a <code>UITableView</code> inside this view</li>
  </ul>
  
  <p>Here are the other tasks I want to accomplish (all programmatically, without using the attribute inspector):  </p>
  
  <ul>
  <li>Insert a <code>UINavigationController</code> into the <code>ViewController</code></li>
  <li>Add a custom cell with three labels</li>
  <li>Update the table view with data</li>
  </ul>
  
  <p>If possible, I would want to have the ability to have everything working in landscape mode as well.</p>
  
  <p>Can anyone tell me how to do this?</p>
  
  <p><strong>AppDelegate.swift</strong></p>
  
  <pre><code>func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -&gt; Bool {
      // Override point for customization after application launch.
  
      window = UIWindow(frame: UIScreen.mainScreen().bounds)
      window!.backgroundColor = UIColor.whiteColor()
      window!.rootViewController = ViewController()
      window!.makeKeyAndVisible()
      return true
  }
  </code></pre>
  
  <p><strong>ViewController.swift</strong></p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
  
      var tableView = UITableView()
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          // Do any additional setup after loading the view, typically from a nib.
  
          tableView = UITableView(frame: self.view.bounds, style: UITableViewStyle.Plain)
          tableView.dataSource = self
          tableView.delegate = self
          tableView.backgroundColor = UIColor.whiteColor()
  
  
          tableView.frame = CGRectMake(0 , 0, self.view.bounds.width, self.view.bounds.height)//Optional for table size
  
          self.view.addSubview(tableView)
      }
  
      func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
          return 5
      }
  
      func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
          let myCell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "myIdentifier")
  
          myCell.textLabel?.text = "\(indexPath.row)"
          myCell.detailTextLabel?.text = "Subtitle"
  
          return myCell
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  }
  </code></pre>
  
  <p>I have no idea how to create a custom cell programmatically to which I can add objects.</p>
  
  <p>Help would be appreciated. </p>
  
  <p>Thanks. </p>