Skip to content

Instantly share code, notes, and snippets.

@Arrlindii
Created June 22, 2019 19:38
Show Gist options
  • Select an option

  • Save Arrlindii/9a0231cc57f70b7a9c58698139b47193 to your computer and use it in GitHub Desktop.

Select an option

Save Arrlindii/9a0231cc57f70b7a9c58698139b47193 to your computer and use it in GitHub Desktop.
let subject = PassthroughSubject<String, Never>()
let publisher = subject.eraseToAnyPublisher()
let subscriber = publisher.sink(receiveValue: { value in
print(value)
})
subject.send("Combine") //The Subscriber will print "Combine"
subject.send("Swift") //The Subscriber will print "Swift"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment