I want to create a generic api utility that I can implement in any model. Therefore, I am currently faced with the problem of outputting error messages from the model regardless of a view. The error messages are needed to trigger a "no internet" or "poor internet connection" notification.
In general, it would help me a lot, regardless of the current view, to generate error messages in different classes in order to then inform the user of a failed process.
Here is my Code so far:
func execute(requestBody: [String: Any], withCompletion completion: @escaping (Data?, Int) -> Void) {
if !CheckApiReachability().getIsApiReachable() {
//trigger error message here
}