Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ns-vasilev committed Nov 10, 2023
1 parent 5fd0c85 commit 382d261
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
![Typhoon: a service for retry policies](https://raw.githubusercontent.com/space-code/typhoon/dev/Resources/typhoon.png)

<h1 align="center" style="margin-top: 0px;">typhoon</h1>

<p align="center">
Expand All @@ -8,7 +10,7 @@
</p>

## Description
`Typhoon` description.
`Typhoon` is a service for retry policies.

- [Usage](#usage)
- [Requirements](#requirements)
Expand All @@ -20,8 +22,38 @@

## Usage

`Typhoon` provides two retry policy strategies:

```swift
/// A retry strategy with a constant number of attempts and fixed duration between retries.
case constant(retry: Int, duration: DispatchTimeInterval)

/// A retry strategy with an exponential increase in duration between retries.
case exponential(retry: Int, multiplier: Double, duration: DispatchTimeInterval)
```

Create a `RetryPolicyService` instance and pass a desired strategy like this:

```swift
import Typhoon

let retryPolicyService = RetryPolicyService(strategy: .constant(retry: 10, duration: .seconds(1)))

do {
_ = try await retryPolicyService.retry {
// Some logic here ...
}
} catch {
// Catch an error here ...
}
```

## Requirements

- iOS 15.0+ / macOS 12+ / tvOS 15.0+ / watchOS 8.0+ / visionOS 1.0+
- Xcode 14.0
- Swift 5.7

## Installation
### Swift Package Manager

Expand Down
Binary file added Resources/typhoon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 382d261

Please sign in to comment.