@Publisher
receive(subscription:)
Exactly One Subscription
receive(_:)
: zero or more Values will be send
receive(completion:)
: At most one Completion. once this method is called, then the subscription will end.
name | descrption |
---|---|
Keypath | connect to a specific property |
sink | Closure |
Subject | subscribe and multicasts values Passthrough subject and |
.sink
メソッドは単にSink
オブジェクトを生成するだけでなく、そのオブジェクトをAnyCancellable
型に型消去する。
Assigns each element from a Publisher to a property on an object.
receive(on:)
Subscriber のcancel
メソッドが呼び出されると、パイプラインを下流から上流にオペレーターのcancelメソッドが呼び出されていき、Publisherはイベントの発行を停止する。
また、Subscriberの参照を削除することでもcancel
メソッドは自動的に呼び出される。