ReactiveCocoa / ReactiveViewModel

Model-View-ViewModel, using ReactiveCocoa
MIT License
1.96k stars 259 forks source link

didBecomeInactiveSignal should skip:1 #30

Closed ashfurrow closed 10 years ago

ashfurrow commented 10 years ago

Discussing with @kylef, it's not intuitive that didBecomeInactiveSignal immediately sends a value of NO in most cases. Complicating matters is the fact that didBecomeInactiveSignal and its corresponding didBecomeActiveSignal are lazily-loaded.

I understand that the header includes the following comment:

// If the receiver is currently active, this signal will send once immediately
// upon subscription.

However, to quote @joshaber, "If we're expecting people to read the docs, we're gonna have a bad time. :hurtrealbad:"

I would suggest we consider that when they are created, if the would immediately send a value due to the current state of active, then they skip:1. Thoughts?

jspahrsummers commented 10 years ago

Intuitive or not, I think it's semantically important that these signals fire immediately.

For example, if you have this expression:

[someLongRunningOperation takeUntil:self.didBecomeInactiveSignal]

You want that to cancel whenever the view model is inactive, regardless of whether it was already so when the signal was subscribed to.

ashfurrow commented 10 years ago

:+1: