Add Retry to README
Amalgamate: combine or unite to form one organization or structure.
The Amalgamate package extends the Combine framework with handy utilities.
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...
File > Swift Packages > Add Package Dependency...
Import the Amalgamate package: import Amalgamate.
import Amalgamate
The Retry publisher retries an upstream publisher when a given condition is met. You can pass a publisher to run before retrying.
upstreamPublisher.retry { value in return indicatesFailure(value) }
Restarts the upstream publisher if the value it sent indicates failure. Failures will just be propagated downstream.
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.
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
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.
Restarts the upstream publisher if the value it sent indicates failure. Failures will just be propagated downstream.
Restarts the API call publisher if the response indicates being unauthorized, but will first authenticate using the authenticate publisher.