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      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

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.