Skip to content

Instantly share code, notes, and snippets.

@podkovyrin
podkovyrin / HTTPClient.swift
Last active January 20, 2024 00:25
Swift Combine HTTP Client with delayed retry
import Combine
import Foundation
struct HTTPClient {
let session: URLSession
let defaultRetryInterval: TimeInterval
let retryCount: Int
init(session: URLSession = .shared, retryCount: Int = 1, defaultRetryInterval: TimeInterval = 2) {
self.session = session