Video App 'Video' does not conform to 'decodable'

Hi Chris and team,

For the Youtube App Lesson 4, I tried to create a items container with video objects but there is an error. “Referencing instance method ‘decode(_:forKey:)’ on ‘Array’ requires that ‘Video’ conform to 'Decodable”. Anyone know why?

Please post your Video struct. Chances are it’s not implemented correctly.

this is My video struct


struct Video {


struct Video: Decodable {

You have to indicate to the compiler that Video conforms to the Decodable protocol.

Oh, and for the future…

Please post your actual code, not screenshots. This makes it easier for others to copy the code and test out solutions to issues. With screenshots, we would need to retype everything. (This issue wasn’t one where that was necessary, but that might not always be the case.) It’s also sometimes easier to read because screenshots can make the text really tiny.

You can paste the code text in with ``` on the line above and the line below and it will format the code nicely for display on the forums.


Got it! Will take note. Thanks for helping!