RetryCount

public enum RetryCount
extension RetryCount: ExpressibleByIntegerLiteral

RetryCount: Configurable retry policy with backoff strategies.

Encapsulates common retry patterns for asynchronous operations, including:

  • No retries (never)
  • Fixed number of retries with optional delay strategy (count)
  • Infinite retries with optional delay strategy (infinity)

Delay strategies are modeled via IntervalProxy, covering fixed delays, pure exponential backoff, and hybrid schemes that switch between exponential and fixed delays.

  • Delay strategy used between retries.

    See more

    Declaration

    Swift

    public enum IntervalProxy
  • Infinite retries using the provided delay strategy.

    Declaration

    Swift

    case infinity(intervalProxy: IntervalProxy = .fixed())
  • Retry up to count times with the provided delay strategy.

    Declaration

    Swift

    case count(count: UInt, intervalProxy: IntervalProxy = .fixed())
  • No retries.

    Declaration

    Swift

    case never
  • Returns the next retry state after consuming one attempt.

    Declaration

    Swift

    public func next() -> RetryCount
  • Indicates whether another retry should be attempted.

    Declaration

    Swift

    public var shouldRetry: Bool { get }
  • The current delay (seconds) to wait before the next retry attempt.

    Declaration

    Swift

    public var timeInterval: TimeInterval { get }
  • Declaration

    Swift

    public init(integerLiteral value: UInt)