John Murcielago John Murcielago - 1 year ago 76
Swift Question

UITableViewDataSource wants smth

I wrote the code for tableView in Xcode 8 beta and then tried to do it in actual Xcode 7. My code below looks correct except UITableViewDataSource issue. Compilers says:

Type 'SettingsVC' does not conform to protocol 'UITableViewDataSource'

It's strange, 'cos I think that I have implemented all required methods.

class SettingsVC: UIViewController, UITableViewDelegate, UITableViewDataSource {

@IBOutlet weak var chooseTable: UITableView!

var tableArray = [String]()

override func viewDidLoad() {
tableArray = ["1", "2", "3", "4", "5"]

override func viewDidAppear(animated: Bool) {

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return tableArray.count

func tableView(tableView: UITableView, cellForRowAt indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier(tableArray[indexPath.item], forIndexPath: indexPath)
cell.textLabel?.text = tableArray[indexPath.row]
return cell

P.S. in Xcode 8 everything works great. The same problems I see in 4 others ViewControllers where I use tables.

Answer Source

Xcode 7 doesn't support swift 3.0, and you're using Swift 3.0 methods for UITableViewDataSource


func tableView(tableView: UITableView, cellForRowAt indexPath: NSIndexPath) -> UITableViewCell {


func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download