UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SOLVED: 100 days of Swift_Day 16_ Designing the interface

Forums > 100 Days of Swift

I'm getting an error in this method (Error editor in placeholder for source file) referring to for: indexPath in the cell constant.

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "Picture", for: indexPath) cell.textLabel?.text = pictures[indexPath.row] return cell }

Did I do something wrong?

3      

Hi @whiteBeltDev

That code work when insert in my project. The error is somewehere else in the code.

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: "Picture", for: indexPath)
    cell.textLabel?.text = pictures[indexPath.row]
    return cell
}

Please put the code in use </> button and insert code inbetween make it easier to read

4      

Also may be a case when error in Xcode gets "stuck" and only goes away after you build the project with newest changes

4      

@nemecek-filip That worked thank you!

3      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.