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

notifications as Signal. #64

Merged
merged 1 commit into from Oct 18, 2016
Merged

notifications as Signal. #64

merged 1 commit into from Oct 18, 2016

Conversation

andersio
Copy link
Member

Signal starts right away, so the weak capturing of observer was removed.

Copy link
Member

@NachoSoto NachoSoto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Can't wait to do the same with UIControl in RAC.

A few comments!

var observedObject: AnyObject? = NSObject()
let producer = center.reactive.notifications(forName: nil, object: observedObject)
observedObject = nil
it("should be freed if it is not reachable and no observers is attached") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn'tno observers be singular?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"observers" is plural.
You could also say "no observer is attached".

@@ -24,10 +24,10 @@ class FoundationExtensionsSpec: QuickSpec {
let center = NotificationCenter.default

it("should send notifications on the producer") {
let producer = center.reactive.notifications(forName: .racFirst)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signal


disposable.dispose()
}
expect(signal).toNot(beNil())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


disposable.dispose()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need another test similar to this one to verify that the signal is not freed if there are other observers.

}

it("should be not freed if it still has one or more active observers") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@NachoSoto
Copy link
Member

🎉

@NachoSoto NachoSoto merged commit de6a136 into master Oct 18, 2016
@NachoSoto NachoSoto deleted the notifications-signal branch October 18, 2016 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants