Skip to content

Instantly share code, notes, and snippets.

@dinotrnka
Created January 17, 2023 12:22
Show Gist options
  • Save dinotrnka/eb7628f36e59f77923d2a3ba43c7b1bf to your computer and use it in GitHub Desktop.
Save dinotrnka/eb7628f36e59f77923d2a3ba43c7b1bf to your computer and use it in GitHub Desktop.
...
static func call(
scheme: String = Config.shared.scheme,
host: String = Config.shared.host,
path: String,
method: HTTPMethod,
parameters: Parameters? = nil,
completion: @escaping CompletionHandler,
failure: @escaping FailureHandler
) {
if !NetworkMonitor.shared.isReachable { // Added this
return failure(.noInternet)
}
var components = URLComponents()
components.scheme = scheme
components.host = host
components.path = path
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment