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

Block support #3

Closed
JiriTrecak opened this issue Feb 16, 2016 · 3 comments
Closed

Block support #3

JiriTrecak opened this issue Feb 16, 2016 · 3 comments

Comments

@JiriTrecak
Copy link

Hello,

first, very nice work indeed. What would help this project to be really great is if the methods offered block version instead of target. That way you would be able to do following:

view.on(tap) {
    // Do something
}

Which removes the decoupling - the need to have different method somewhere else in the code.

Thanks for your time doing this library!

Sincerely,
Jiri

@delba
Copy link
Owner

delba commented Feb 16, 2016

Hey @JiriTrecak,

Tactile already supports this 😄

All of the followings are equivalent:

1.

view.on(tap, tapped)

// ...

func tapped(tap: UITapGestureRecognizer) {
    print(tap)
}

2.

let tapped = { (tap: UITapGestureRecognizer) -> Void
    print(tap)
}

view.on(tap, tapped)

3.

view.on(tap) { print($0) }

Note that you can also use the shorthand methods:

view.tap { print($0) }

@delba delba closed this as completed Feb 16, 2016
@JiriTrecak
Copy link
Author

Man am I dumb today! Thanks, and sorry :) (maybe would be nice to highlight it more in the docs)

@delba
Copy link
Owner

delba commented Feb 16, 2016

Ahaha no problem! Thanks for Laurine btw 🙏

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

No branches or pull requests

2 participants