title: create a UITableViewController programmatically in Swift
body: <p>I'm trying to, as the title say, set up a UITableViewController programmatically. After a few hours of trying I hope someone can help me. And, yes, I hve checked out other posts on this matter:</p>
  
  <pre><code>import UIKit
  
  class MainViewController: UITableViewController {
  
      init(style: UITableViewStyle) {
          super.init(style: style)
          // Custom initialization
      }
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
  
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
      // #pragma mark - Table view data source
  
      override func numberOfSectionsInTableView(tableView: UITableView?) -&gt; Int {
          return 1
      }
  
      override func tableView(tableView: UITableView?, numberOfRowsInSection section: Int) -&gt; Int {
          return 5
      }
  
  
      override func tableView(tableView: UITableView?, cellForRowAtIndexPath indexPath: NSIndexPath?) -&gt; UITableViewCell? {
          var cell = tableView?.dequeueReusableCellWithIdentifier("Cell") as? UITableViewCell
  
          if !cell {
              cell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: "Cell")
          }
          cell!.textLabel.text = "test"
          return cell
      }
  
  }
  </code></pre>
  
  <p>and the appDelegate looks like this:</p>
  
  <pre><code>func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -&gt; Bool {
          self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
  
          let mainViewController: UITableViewController = MainViewController(style: UITableViewStyle.Plain)
          let navigationController: UINavigationController = UINavigationController()
          navigationController.pushViewController(mainViewController, animated: false)
  
          self.window!.rootViewController = navigationController
          self.window!.backgroundColor = UIColor.whiteColor()
          self.window!.makeKeyAndVisible()
          return true
      }
  </code></pre>
  
  <p>The program run, but as soon as it does, I get the following error:</p>
  
  <pre><code>fatal error: use of unimplemented initializer 'init(nibName:bundle:)' for class 'HelloWorld.MainViewController'
  </code></pre>
  
  <p>I then changes the <code>MainViewController(style: UITableViewStyle.Plain)</code> to <code>MainViewController(nibName: nil, bundle: nil)</code> but then I get the following syntax error: <code>Extra argument 'bundle' in call</code></p>
  
  <p>Any help would be much appreciated</p>