Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only next events are forward to an action's observer #2784

nmarisi opened this issue Apr 7, 2016 · 1 comment

Only next events are forward to an action's observer #2784

nmarisi opened this issue Apr 7, 2016 · 1 comment


Copy link

@nmarisi nmarisi commented Apr 7, 2016

As far as I can see, only the next events are forwarded to an action's observer. So for example, completed events are ignored.

Here's an example:

buttonAction = Action<Bool, Void, NoError>() { value in

    return SignalProducer<Void, NoError> { observer, _ in


Observing the events signal: {
    print("observed completed")
} {
    print("observed next")

The print statement for the completed event is never triggered (unless the action is deallocated).

It's clear on Action.swift ( line 119), that this is actually happening:

signal.observe { event in
    observer.action(event.mapError { .ProducerError($0) })

Is this intended behaviour? Shouldn't the action be forwarding Completed, Failed and Interrupted events too?

@ikesyo ikesyo added the question label Apr 7, 2016

This comment has been minimized.

Copy link

@ikesyo ikesyo commented Apr 7, 2016

This is intended behavior. Since the signature is public let events: Signal<Event<Output, Error>, NoError>, you can observe the inner producer's Completed events as follows: { event in
    switch event {
    case let .Next(value): ... // A Next event from the inner producer
    case .Completed: ... // A Completed event from the inner producer
    default: break
@ikesyo ikesyo closed this Apr 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.