ReplayLatest simplifies sharing and receiving the most recent values immediately upon subscription.
Import ReplayLatest into your files:
import ReplayLatest
Use the operator in your publisher chain declaration:
let subject = PassthroughSubject<Int, Never>()
let publisher = subject.replayLatest(capacity: 2)
ReplayLatest includes a built-in printSink() operator for easy debugging without additional subscribers:
Just("value").printSink()
Add ReplayLatest to your dependencies:
dependencies: [
.package(url: "https://github.com/AbdAlAlii/ReplayLatest.git")
]
ReplayLatest is licensed under the MIT License. See the LICENSE file for more information.