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

Introduce Lifetime.Token.dispose. #641

Merged
merged 1 commit into from
May 28, 2018
Merged

Conversation

andersio
Copy link
Member

@andersio andersio commented May 26, 2018

This hopefully makes attaching lifetime to producer chains more natural.

let (lifetime, token) = Lifetime.make()

let producer = SignalProducer.combineLatest(conditionA, conditionB, conditionC)
    .filter { $0 && $1 && $2 }

// Before
producer.startWithCompleted { _ = token }

// After
producer.startWithCompleted(token.dispose)

Checklist

  • Updated CHANGELOG.md.

@@ -86,7 +86,8 @@ extension Lifetime {
}

extension Lifetime {
/// A token object which completes its signal when it deinitializes.
/// A token object which completes its associated `Lifetime` when
/// it deinitializes, or when `terminate()` is called.
Copy link
Contributor

Choose a reason for hiding this comment

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

This should say dispose(), not terminate().

@mdiep
Copy link
Contributor

mdiep commented May 26, 2018

I like it. 👍 👍

This should be a lot clearer for most people.

@andersio andersio force-pushed the anders/lifetime-token-dispose branch 2 times, most recently from 51ff7bb to 649c9ab Compare May 27, 2018 15:40
@andersio andersio force-pushed the anders/lifetime-token-dispose branch from 649c9ab to 7c2bbc7 Compare May 27, 2018 15:44
@andersio andersio requested a review from mdiep May 27, 2018 15:44
@andersio andersio merged commit 9b946fa into master May 28, 2018
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

3 participants