Skip to content

Instantly share code, notes, and snippets.

@shakemno
Forked from juliancadi/Combine+Ext.swift
Created March 3, 2020 16:38
Show Gist options
  • Save shakemno/7b81b0db14353a27e2b4beca2dd13707 to your computer and use it in GitHub Desktop.
Save shakemno/7b81b0db14353a27e2b4beca2dd13707 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