I need to get a generic variable for a struct for parsing a JSON
but there is an error that I am getting Type 'BaseJsonModel' does not conform to protocol 'Codable
Below is my struct
struct BaseJsonStruct<T>: Codable {
let info: String
let data: T
}
Error:- Type 'BaseJsonModel' does not conform to protocol 'Codable'
T
must also conform to Codable
struct BaseJsonStruct<T : Codable> : Codable {
let info: String
let data: T
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.