Cannot convert value of type 'UIImageView?' to expected argument type 'String'

I am currently reading this book “iOS 12 & swift for beginners” on Chapter: 32 UI Improvement am stack at this.
“ Use the Assistant Editor to add an outlet property for the cell to ListDetailViewController.swift and name it iconImage.”

Excerpt From: By Ray Wenderlich. “iOS 12 and Swift for Beginners.” Apple Books.

have created an outlet for the entire prototype cell as

@IBOutlet weak var iconImage: UITableViewCell!

when I use it in viewDidload() I run into this error Cannot convert value of type 'UITableViewCell?' to expected argument type 'String'

I also tried changing from the prototype cell to the specific image view and created an outlet as @IBOutlet weak var iconImage: UIImageView! but still got another error of Cannot convert value of type 'UIImageView?' to expected argument type 'String'.
Is there something am doing wrong?

Unfortunately, the information you’ve provided to find the position in the book wasn’t very helpful at all - the sentence you mention isn’t in chapter 32 at all. It is in Chapter 19. Providing the correct information can hep in figuring things out and helping you find what has gone wrong …

Given that you haven’t provided the code you have in viewDidLoad I can’t tell what might be going wrong. One thing you can do is check your project against the provided final project in the book if you want to troubleshoot the issue yourself.

Alternatively, please upload your project as a ZIP file somewhere and provide a link to the ZIP file so that I (or someone else) can download the file and see what might be going on.

@fahim thank you for getting back.
There is a book a companion book for Udemy course it has the section on Chapter 32 :slight_smile:.
Here is a link to the project I did based on the book Another thing the download folder for project they provided on the download section the folders from section 22 - 33 they are empty also the icons I had to create my own icons the folder was missing.

Ah, I had no idea :slight_smile: I don’t know much about the Udemy course I’m afraid and so am hoping that somebody else can answer your questions about the missing resources for the Udemy course. @shogunkaramazov who would know about that?

I took a look at the project you provided and I see the issue :slight_smile: Basically, you should provide the iconName variable for the image name since the iconName variable is a string variable which contains the name of the icon. Instead, you’ve provided iconImage which is a reference to the image view. I realize that the names are similar and could be confusing but if the text is correct in the companion book, then the correct name should have been there in the code :slight_smile:

@fahim thank you so much for quick reply and assistance, I had passed a wrong name iconImage.image = UIImage(named: iconName), . :+1: You’ve been mentioned several times in the course haha,

Happy to hear that that resolved the issue :slight_smile:

This topic was automatically closed after 166 days. New replies are no longer allowed.