Type does not conform to Identifiable when decoding JSON data Type does not conform to Identifiable when decoding JSON data json json

Type does not conform to Identifiable when decoding JSON data


You can use computable property, like

struct Pokemon: Decodable, Identifiable {    var id: Int { nr }                       // << here !!    let nr: Int    let name: String    let imageUrl: String    let type: String}