Skip to content

Instantly share code, notes, and snippets.

View iosdroid's full-sized avatar
Working from home

iOSDevloper iosdroid

Working from home
View GitHub Profile
iosdroid / Alamofire.request.error.handling.swift
Created March 29, 2021 10:52 — forked from perlguy99/Alamofire.request.error.handling.swift
Alamofire Request Error Handling - From their documentation
Alamofire.request(urlString).responseJSON { response in
guard case let .failure(error) = response.result else { return }
if let error = error as? AFError {
switch error {
case .invalidURL(let url):
print("Invalid URL: \(url) - \(error.localizedDescription)")
case .parameterEncodingFailed(let reason):
print("Parameter encoding failed: \(error.localizedDescription)")
print("Failure Reason: \(reason)")