Swift — UITableView (programmatically)

  1. Create new ‘Cocoa Class’ file (press Command + N) and select the name of your project (ex, TableViewController.swift).
  2. Open storyboard. Add new View Controller and add name of the class in the Identity Inspector (TableViewController)
  3. Create a class TableViewController and add UITableViewDelegate,UITableViewDataSource

4. Create a tableView and a variable where you are going to store the objects you are going to display in your tableView:

5. Initialize and set your tableView: