Skip to content

Instantly share code, notes, and snippets.

@juliancadi
Created March 3, 2020 16:12
Show Gist options
  • Save juliancadi/278bf814f1756bb4f42d48355f7e8a9f to your computer and use it in GitHub Desktop.
Save juliancadi/278bf814f1756bb4f42d48355f7e8a9f to your computer and use it in GitHub Desktop.
Combine side effect
extension Publisher {
public func on(_ f: @escaping (Self.Output) -> Void) -> AnyPublisher<Self.Output, Self.Failure> {
self.map {
f($0)
return $0
}.eraseToAnyPublisher()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment