jonnie
jonnie

Reputation: 12690

How do I Change a UIViewController to a UITableViewController in xcode

I am new to swift/ios programming and following the hackingwithswift.org tutorials. I am to specifically trying to change the initial view controller to a table view

The problem I am facing is I have no idea how to change the initial view controller to a table view. I tried copying the existing ViewController to a new WebViewController and update the existing swift file from:

class ViewController: UIViewController, WKNavigationDelegate {
 ...

to :

class ViewController: UITableViewController {
 ...

with the required methods but when I run the simulator it crashes with :

terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', 
reason: '-[UITableViewController loadView] loaded the "BYZ-38-t0r-view-8bC-Xf-vdC" 
nib but didn't get a UITableView.'
terminating with uncaught exception of type NSException

I think I need to update something in storyboard but I am lost as to what or how.

I am using xcode 12

This general workflow confuses me a lot and would also appreciate any links to doc/books to help someone whos a Fullstack developer with very little mobile exposure

Upvotes: 0

Views: 94

Answers (1)

Shehata Gamal
Shehata Gamal

Reputation: 100523

If in code you changed base class from UIViewController to UITableViewController then you have to drag a table template in IB not a usual VC

Upvotes: 2

Related Questions