Networking rework: simplified API calls.
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// Logger.swift
|
||||
// Nextcloud Cookbook iOS Client
|
||||
//
|
||||
// Created by Vincent Meilinger on 13.11.23.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import OSLog
|
||||
|
||||
extension Logger {
|
||||
private static var subsystem = Bundle.main.bundleIdentifier!
|
||||
|
||||
/// UI related logging
|
||||
static let view = Logger(subsystem: subsystem, category: "view")
|
||||
|
||||
/// Network related logging
|
||||
static let network = Logger(subsystem: subsystem, category: "network")
|
||||
}
|
||||
Reference in New Issue
Block a user