Question about Images

How can I overcome this?

You need to reference the images by the image name, as in tutorial-1 and it should be in quotes.

Assuming that image is defined as a String then:

let video1 = Video(image: “tutorial-1”, title: “Your first App”)

It doesn’t work. The problem is shown below:

It’s impossible to say what the problem is when we can’t see the error message. “Cannot convert value…” is very uninformative.

We also probably need to see your Video object.

I have no videos there, only images. That’s the error message:

What is your Video struct definition?

I didn’t understand what do you mean by Video struct definition. Therefore I sent you all I didn’t before.

The Video class is asking for a UIImage but you are giving it a String.

You need to change this line:

let video1 = Video(image: "tutorial-1", title: "Your First App")

to this:

let video1 = Video(image: UIImage(named: "tutorial-1"), title: "Your First App")

and adjust as necessary for the other lines.

And you really need to start posting code instead of screenshots. Look at all the wasted space there. We don’t need to see Xcode’s sidebars in order to help you with your issue. And although it wasn’t necessary this time, if someone needs to test some code for a solution, they’ll have to completely retype all your other code in first. Pasting your actual code (fenced between ``` backticks) will aid matters greatly and increase your chances of getting help.

Thanks for chipping in Patrick. That’s what I was going to add 7 hours ago but I was so damned tired I had to crash.