0Pricing
Swift Academy · Lesson

PassthroughSubject and CurrentValueSubject

Using subjects as bridges between imperative code and Combine pipelines.

Welcome

Subjects are both publishers and subscribers. They bridge imperative code to reactive Combine pipelines.

PassthroughSubject

```swift let subject = PassthroughSubject() subject.sink { print($0) }.store(in: &cancellables) subject.send("Hello") subject.send("World") // Hello, World ``` Late subscribers miss previously sent values.

All lessons in this course

  1. Publishers and Subscribers
  2. Operators: map, filter, combineLatest
  3. PassthroughSubject and CurrentValueSubject
  4. Networking with Combine and URLSession
← Back to Swift Academy