https://github.com/rugheid/swift-amalgamate
The Amalgamate package extends the Combine framework with handy utilities.
https://github.com/rugheid/swift-amalgamate
combine-framework ios13 macos swift swift-package-manager tvos watchos
Last synced: over 1 year ago
JSON representation
The Amalgamate package extends the Combine framework with handy utilities.
- Host: GitHub
- URL: https://github.com/rugheid/swift-amalgamate
- Owner: rugheid
- Created: 2019-08-17T13:03:26.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-17T13:15:45.000Z (almost 7 years ago)
- Last Synced: 2024-10-23T22:18:35.041Z (over 1 year ago)
- Topics: combine-framework, ios13, macos, swift, swift-package-manager, tvos, watchos
- Language: Swift
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Amalgamate
_Amalgamate: combine or unite to form one organization or structure._
The Amalgamate package extends the Combine framework with handy utilities.
## Installation
Amalgamate is only available as a Swift Package.
If you're using Xcode 11, you can add it using `File > Swift Packages > Add Package Dependency...`
## Usage
Import the Amalgamate package: `import Amalgamate`.
### Retry
The Retry publisher retries an upstream publisher when a given condition is met. You can pass a publisher to run before retrying.
```swift
upstreamPublisher.retry { value in
return indicatesFailure(value)
}
```
Restarts the upstream publisher if the value it sent indicates failure. Failures will just be propagated downstream.
```swift
apiCallPublisher.retry(butFirst: authenticatePublisher) { response in
return response.statusCode == 401
}
```
Restarts the API call publisher if the response indicates being unauthorized, but will first authenticate using the authenticate publisher.