I\'m a newbie to Swift and XCode, taking a class in iOS development this summer. A lot of projects we\'re doing and examples I\'m seeing for UI elements like PickerViews, Ta
You are trying to set datasource and delegate of UITableView as UITableViewController
. As @Ahmad mentioned its more understandable in same class i.e. ViewController, you can take clear approach separating datasource and delegate of UITableView
from UIViewController
. You can make subclass of NSObject preferably and use it as datasource and delgate class of your UITableView
.
You can also also use a container view
and embed a UITableViewController
. All your table view code will move to your UITableViewController subclass.Hence seprating your table view logic from your View Controller
Hope it helps. Happy Coding!!