a guest Oct 22nd, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import Combine
  2. extension Publisher where Failure == Never {
  3.     func optionalAssign<Root>(to keyPath: ReferenceWritableKeyPath<Root, Optional<Output>>,
  4.                               on: Root) -> AnyCancellable {
  5.         map{let output:Output? = $0;return output}
  6.             .assign(to: keyPath, on: on)
  7.     }
  8. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand