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

Use a token based API to reduce boilerplate code. #11

Open
the-freshlord opened this issue May 1, 2018 · 0 comments
Open

Use a token based API to reduce boilerplate code. #11

the-freshlord opened this issue May 1, 2018 · 0 comments
Labels

Comments

@the-freshlord
Copy link
Owner

It might be good to explore using a token based API where tokens are used to identify and remove observers. This will remove boilerplate code like this:

dog.age.bind({ (newAge) in
    print("This is the dog's new age: \(newAge)")
}, for: self)

to:

dog.age.bind {
    print("This is the dog's new age: \($0)")
}

The bind and bindAndFire methods would return a discardable token that would be used for identifying the observer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant