Anonymous Anonymous - 24 days ago
140 0

Where's the wrong?

Swift

ViewController does not conform to protocol 'UITableViewDataSource' (SWIFT 3)

class SecondViewController: UIViewController, UITableViewDataSource, UITableViewDelegate

{

@IBOutlet weak var tableView: UITableView!
var videos:[video] = [video]()

@IBOutlet weak var menuButton: UIBarButtonItem!
override func viewDidLoad() {
    super.viewDidLoad()




        if self.revealViewController() != nil {
        menuButton.target = self.revealViewController()
        menuButton.action = #selector(SWRevealViewController.revealToggle(_:))
        self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())


        let model = videoModel()
        self.videos = videoModel().getVideos()

        self.tableView.dataSource = self
        self.tableView.delegate = self

    }

func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }


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


func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "BasicCell", for: indexPath)

        let videoTitle = videos[indexPath.row].videoTitle

        //customize the cell
    cell.textLabel?.text = videoTitle


    return cell

    }

}
}
Comments