Swift Combine: CurrentValueSubject vs PassthroughSubject, commonalities and differences

What is Subject?

PassthroughSubject, CurrentValueSubject

Commonalities

Both PassthroughSubject and CurrentValueSubject can subscribe
Passing down new value with Subject
Sending completion finished with Subject

Difference

PassthroughSubject, CurrentValueSubject

What do I have to use between CurrentValueSubject and PassthroughSubject?

Using together

Conclusion

  • Subject

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
KD Knowledge Diet

KD Knowledge Diet

2.4K Followers

Software Engineer, Mobile Developer living in Seoul. I hate people using difficult words. Why not using simple words? Keep It Simple Stupid!