BackoffPolicy
How a WorkRequest is retried after WorkResult.Retry.
Both shapes carry maxAttempts: once a worker has been attempted that many times within a single retry cycle, the library converts the next WorkResult.Retry to WorkResult.Failure (Android: returns Result.failure(); iOS: stops resubmitting). For periodic workers, the counter resets after each WorkResult.Success cycle.
@OptIn(ExperimentalObjCName::class): Swift-rename annotations so iOS app code calls BackoffPolicy.linear(initialDelay:maxAttempts:) cleanly (CLAUDE.md §8). The companion-factory shape is acceptable here because the sealed-interface variants leave no alternative constructor surface.
Inheritors
Types
Exponential: delay = initialDelay × 2^attempt, capped at MAX_BACKOFF. delayFor(0) = initialDelay, delayFor(1) = 2 × initialDelay, delayFor(2) = 4 × initialDelay, …
Linear: delay = initialDelay × (attempt + 1). So delayFor(0) = initialDelay, delayFor(1) = 2 × initialDelay, delayFor(2) = 3 × initialDelay, …