If you're not using Storyboards and just want a clean, concise way to setup your UITableViewController subclass to use a different tableView style, you can simply override loadView
like this:
override func loadView() {
let tableView = UITableView(frame: .zero, style: .grouped)
tableView.delegate = self
tableView.dataSource = self
view = tableView
}
As the documentation says:
loadView
creates the view that the controller manages
it's a method you can ovveride when using ViewControllers whose views are not defined via Storyboards or NIBs.
The UITableViewController
implementation already overrides this method for you to crate a simple, plain UITableView
as the root view for the controller, but nothing stops you from further overriding it to create a table view that better suits your needs.
Just remember:
Your custom implementation of this method should not call super.