Networking rework: simplified API calls.

This commit is contained in:
Vicnet
2023-11-16 13:13:06 +01:00
parent 17678dea5f
commit 3563c23e29
14 changed files with 731 additions and 97 deletions

View File

@@ -11,11 +11,9 @@ extension JSONDecoder {
static func safeDecode<T: Decodable>(_ data: Data) -> T? {
let decoder = JSONDecoder()
do {
print("Decoding type ", T.self, " ...")
return try decoder.decode(T.self, from: data)
} catch (let error) {
print("JSONDecoder - safeDecode(): Failed to decode data.")
print("Error: ", error)
print(error)
return nil
}
}