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

Add pactions command to print the target/actions of a UIControl #95

Merged
merged 2 commits into from
May 27, 2015

Conversation

kastiglione
Copy link
Contributor

I've been meaning to add a pactions command for a while. It's pretty basic. It would be nice to print out which control event the action observes, but this covers probably 90+% of the cases. In #59, I mentioned it might be nice to have a bactions command too, but I'm thinking that's a wait and see enhancement.

For a view controller, an example of the output is:

<XXXViewController: 0xdddddddd>: didTapButton:

and if there are multiple actions:

<XXXViewController: 0xdddddddd>: didTapButton:, didTouchButton:

cc @arigrant

actions = fb.evaluateObjectExpression('[{control} actionsForTarget:{target} forControlEvent:0]'.format(control=control, target=target))

targetDescription = fb.evaluateExpressionValue('(id){target}'.format(target=target)).GetObjectDescription()
actionsDescription = fb.evaluateExpressionValue('(id)[{actions} componentsJoinedByString:@","]'.format(actions=actions)).GetObjectDescription()
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this look like when it prints?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes, I meant to include an example output, thanks for asking!

For a view controller, something like:

<XXXViewController: 0xdddddddd>: didTapButton:

If there are multiple actions:

<XXXViewController: 0xdddddddd>: didTapButton:, didTouchButton:

The output would be messier if the target provides a verbose -description method. Perhaps this shouldn't rely on the built in -description and should instead manually format the <Class: 0xdddddddd> string.

arigrant added a commit that referenced this pull request May 27, 2015
Add `pactions` command to print the target/actions of a UIControl
@arigrant arigrant merged commit bd12c6a into master May 27, 2015
@kastiglione kastiglione deleted the pactions branch May 27, 2015 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants