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

后端 未结 17 2570
旧巷少年郎
旧巷少年郎 2020-11-29 03:02

Started practice swift. In singleViewController I am trying to make a UITableView. In storyboard I set the datasource and delegate. Here I am getting the error

17条回答
  •  眼角桃花
    2020-11-29 03:25

    Change the syntax of "UITableViewDataSource" protocol required methods as per new swift 3 documentation:

    internal func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int

    internal func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell

    This has worked for me while compiling with swift 3 compiler

提交回复
热议问题