I have a git repository of an app that has been working properly and is available on iTunes. I recently wanted to add some updates to it and imported the project into xCode 10. When I tried to build the solution, I get an error "Generic parameter 'T' could not be inferred"
I have tried to update all the pods that are being used.
Here is the code with the error
static func toJSON<T>(_ data: [T]) -> NSArray {
let encoded = try! JSONEncoder().encode(data)
let jsonObject = try! JSONSerialization.jsonObject(with: encoded,
options: []) as! NSArray
return jsonObject
}
and the error seems to appear on this line
let encoded = try! JSONEncoder().encode(data)
I am very new to Swift and only inherited this project so I am unsure as to what my approach should be in resolving this issue. I've looked through other questions but could not see a solution that would work for me.