Here is the top of the JSON and the first item of the array.
I want to use title, description, poster, and the link in videos.mp4.480
struct Row: Codable {
var title:String?
var desciption:String?
var Poster:String?
struct videos: Codable {
struct mp4: Codable {
var _480: String?
}
}
}
This can compile but does not make sense. You declare struct (mp4) inside struct (videos) inside struct (row) but do not use them.
Maybe you want something like this (note that struct names should start with Uppercase.
struct MP4: Codable {
var _480: String?
}
struct Videos: Codable {
var mp4: MP4?
}
struct row: Codable {
var title:String?
var desciption:String?
var Poster:String?
var videos: [Videos]
}
Why do you make everything optional ?
The JSON file, is weird. For instance "ttps://videos.kaiserclix.com/AVideo/videos/_YPTuniqid_5fbfd4096d6855.75762245_240.mp4" instead of https
You need to describe properly the JSON format in your struct, for instance, you would have an array of Row.
Learn how to do this. Here is a tutorial: https://www.raywenderlich.com/3418439-encoding-and-decoding-in-swift