Skip to content

Instantly share code, notes, and snippets.

View aleos's full-sized avatar
🚀
Bright future ahead

Alexander Ostrovsky aleos

🚀
Bright future ahead
View GitHub Profile
@nunogoncalves
nunogoncalves / BetterDecodingError.swift
Last active January 26, 2024 08:37
Better Decoding Error Messages
import Foundation
enum BetterDecodingError: CustomStringConvertible {
case dataCorrupted(_ message: String)
case keyNotFound(_ message: String)
case typeMismatch(_ message: String)
case valueNotFound(_ message: String)
case any(_ error: Error)
@tahseen0amin
tahseen0amin / APIManager.swift
Created February 25, 2018 19:27
Complete API Manager
import Foundation
protocol ApiRequest {
var urlRequest: URLRequest { get }
}
protocol ApiClient {
func execute<T>(request: ApiRequest, completionHandler: @escaping (_ result: Result<ApiResponse<T>>) -> Void)
}
@lattner
lattner / TaskConcurrencyManifesto.md
Last active September 28, 2025 00:18
Swift Concurrency Manifesto
struct API {
typealias Result = () throws -> JSON
enum Error: ErrorType {
case ConnectionError(NSError?)
case ServerError(statusCode: Int, message: String?)
case JSONError(NSError?)
}
}