TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

Understanding the PassthroughSubject and CurrentValueSubject

Forums > Swift

Can someone please help me understand PassthroughSubject and CurrentValueSubject? What I understand so far is that they are subjects where subscribers can listen to changes made to these subjects, but I'm really straggling to understand the following.

I'm I correct by saying that PassthroughSubject or CurrentValueSubject could replace delegation and asynchronous function calls?

Is it possible to delare a subject in Class A and subscribe to listen to those subject changes in Class B and in some other classes or are listeners meant to only be used direclty in SwiftUI structs?

Thanks

3      

I want to share Advance Combine. It is quite long tutorial, you may find what you looking for. It is very well prepared about Published and PassthroughSubject and CurrentValueSubject. I hope you will find it useful

4      

I'll definately take a look at it, I really like Nick's tutorials.

3      

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.