I'm getting a result and I'm trying to make it JSON serializable, which probably mean to convert it from NSObject to Object. Is that possible? I've checked Codable, but I didn't understand what I'm supposed to do. My result could change in the future (types, keys, values, etc).
dump(result):
{ test1: 123, test2: () }> #0
- super: NSObject
Edit:
let result = appleIDCredential
let jsonEncoder = JSONEncoder()
let jsonData = try jsonEncoder.encode(result)
let json = String(data: jsonData, encoding: String.Encoding.utf8)
Returns:
Argument type 'ASAuthorizationAppleIDCredential' does not conform to expected type 'Encodable'