I have following simple protocol:
protocol JSONParser {
associatedtype JSONResult
func parse<T: Codable>(response: Response, type: T) -> JSONResult
}
Function parse
takes simple Response
which is struct and takes T
which is Codable
. And here is how I implement this protocol:
struct AuthJSONParser: JSONParser {
func parse<T: Codable>(response: Response, type: T) -> AuthResult<T> {
}
}
It seems everything okay. But Xcode says that it does not conform to protocol.
Here AuthResult<T>
just for case:
enum AuthResult<Model: Codable> {
case success(data: Model)
case failed(msg: String)
}
I can't figure out what is wrong with my implementation. I want to use generic functions, instead of generic structs.