# Chapter 2: PassthroughSubject

**URL:** <https://forums.kodeco.com/t/chapter-2-passthroughsubject/147211>\
**Category:** Combine: Asynchronous Programming with Swift\
**Created:** [August 31, 2021, 6:03pm UTC](https://forums.kodeco.com/t/chapter-2-passthroughsubject/147211 "2021-08-31T18:03:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![perlguy](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/perlguy/32/108860_2.png) [@perlguy](https://forums.kodeco.com/u/perlguy)\
**Post date:** [August 31, 2021, 6:03pm UTC](https://forums.kodeco.com/t/chapter-2-passthroughsubject/147211/1 "2021-08-31T18:03:45Z")

</div>

I’m not seeing the “Still there?” that the book says should be printing in the example. I looked through the code but didn’t see anything I missed… Can I get another set of eyes on this?

```auto
example(of: "PassthroughSubject") {
    enum MyError: Error {
        case test
    }
    
    final class StringSubscriber: Subscriber {
        typealias Input = String
        typealias Failure = MyError
        
        func receive(subscription: Subscription) {
            subscription.request(.max(2))
        }
        
        func receive(_ input: String) -> Subscribers.Demand {
            print("Received value", input)
            
            return input == "World" ? .max(1) : .none
        }
        
        func receive(completion: Subscribers.Completion<MyError>) {
            print("Received completion", completion)
        }
    }
    
    let subscriber = StringSubscriber()
    
    let subject = PassthroughSubject<String, MyError>()
    
    subject.subscribe(subscriber)
    
    let subscription = subject
        .sink(
            receiveCompletion: { completion in
                print("Received completion (sink)", completion)
            },
            receiveValue: { value in
                print("Received value (sink)", value)
            }
        )

    subject.send("Hello")
    subject.send("Brent")
    
    subscription.cancel()
    
    subject.send("Still there?")
}

```

and the output I get is:

```auto
——— Example of: PassthroughSubject ———
Received value Hello
Received value (sink) Hello
Received value Brent
Received value (sink) Brent

```

---

<div class="post-metadata">

**Author:** ![tchelyzt](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/tchelyzt/32/111572_2.png) [@tchelyzt](https://forums.kodeco.com/u/tchelyzt)\
**Post date:** [January 16, 2022, 11:11pm UTC](https://forums.kodeco.com/t/chapter-2-passthroughsubject/147211/2 "2022-01-16T23:11:13Z")

</div>

Hi perlguy  
your max is still at 2 because you decided to send “Brent” instead of “World”. World is the input that increases the max to 3.  
Either send “World” or change this line:

> [@perlguy](#):
>
> `return input == "World" ? .max(1) : .none`
