RxSwiftCommunity / Action

Abstracts actions to be performed in RxSwift.
MIT License
875 stars 150 forks source link

Why use AnyObserver instead of InputSubject #197

Closed wsof401 closed 5 years ago

wsof401 commented 5 years ago

If any observable which may emit error or complete event.

The trigger of Action's property: input, would never be triggered.

let action = Action<Void, String>(workFactory: { .just("received input") })
action.elements.bind {
 // This only print once
  print($0)
} 
let value1 = Observable.just()
let value2 = Observable.just()

// print "received input"
value1.bind(to: action.input)

// nothing happend
value2.bind(to: action.input)