Group Group Group Group Group Group Group Group Group

[Combine]subscribe method

I know publisher has a method subscribe(_ subject: Subject)

let arrPublisher = [1,2,3,4].publisher
let tester = PassthroughSubject<Int, Never>()

arrPublisher.sink { result in
    print(result)
}.store(in: &subscriptions)
arrPublisher.subscribe(tester)
tester.send(5)

why tester as a subject cant send data after publisher has subscribed it.

As per the documentation of Sequence.publisher Apple Developer Documentation once the sequence of element is exhausted the publisher completes.

In your example you are trying to send a value after a completion event.