I am just starting out with Argo to parse my json response into objects. I having the following code (see below) but it keeps throwing up the following errors:
Type 'Application' does not conform to protocol 'Decodable'
Cannot invoke 'curry' with an argument list of type '((applicationID: String, contact: String, state: String, jobTitle: String, area: String, pay: String) -> Application)'
import Foundation
import Argo
import Curry
struct Application {
let applicationID: String
let contact: String
let state: String
let jobTitle: String
let area: String
let pay: String
}
extension Application: Decodable {
static func decode(j: JSON) -> Decoded<Application> {
return curry(Application.init)
<^> j <| "ApplicationID"
<*> j <| "contact"
<*> j <| "state" // Use ? for parsing optional values
<*> j <| "jobTitle" // Custom types that also conform to Decodable just work
<*> j <| "area" // Parse nested objects
<*> j <| "pay" // parse arrays of objects
}
}
I have extended application to be decodable so don't understand why I am getting this error.
Also I have tried adding the example from the Argo git hub page here: https://github.com/thoughtbot/Argo with struct type User
. However this is throwing up the same error.
I have used cocoa pods to install argo and curry. I have also cleaned my project and restarted since installing them. However I am still getting these errors.
Does anyone know why this might be happening?