To create UITableView in Swift, there are basically two steps:
UITableView in a view controller,Here are the steps to create UITableView :
UITableViewController or simply UIView and add a UITableView instance to it using the storyboard.UITableView instance.UITableViewCell custom class (optional) to render content inside the cell.UITableView instance to the view controller by creating an IBOutlet and adding a delegate and data source property to the view controller.main.swift1252 chars39 linesIn the above code snippet, we set UITableViewController as primary view controller or simply add a view with UITableView instance added to it by using IBOutlet. We set data source and delegate of UITableView to the view controller. We created an array of string items and provided item to cell by using the cellForRowAt Datasource method.
We also implemented didSelectRowAt TableView method to provide user feedback on cell selection.
Note: The above example assumes that you have created a custom TableViewCell subclass named CustomTableViewCell with a UILabel named itemLabel.
gistlibby LogSnag