Skip to content

Conversation

jkubicek
Copy link

@jkubicek jkubicek commented Mar 7, 2014

Shortcut is fovc. Given an input UIView this command will walk the next
responder chain until it finds the UIViewController that owns this view.

Shortcut is `fovc`. Given an input `UIView` this command will walk the next
responder chain until it fines the UIViewController that owns this view.
return 'fovc'

def descriptino(self):
return 'Find the view controller that owns the input view'
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a period at the end.

def nextResponder(object):
command = '[((id){}) nextResponder]'.format(object)
nextResponder = fb.evaluateObjectExpression(command)
if int(nextResponder, 0):
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be try/except instead of if/else.

Copy link
Author

Choose a reason for hiding this comment

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

@kastiglione Unless I'm missing something (I'm fairly new to Python) we still need an if statement. "0x000000" is a valid return value and is what my original int() conversion was designed to catch. I did wrap the int() function in an exception block, though.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see what you mean. This looks good to me. @kastiglione what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I misunderstood the original intention of catching 0x000000. 👍

Jim Kubicek added 2 commits March 9, 2014 15:30
fvc will default to searching for view controllers via class name regex. If the --view option is set, we can search for the owning view controller.
@jkubicek
Copy link
Author

I think I've addressed all the comments. Please let me know if I've missed anything or if you notice any issues!

@arigrant
Copy link
Contributor

Looks great, thanks!

arigrant added a commit that referenced this pull request Mar 15, 2014
Added Find Owning View Controller command
@arigrant arigrant merged commit 82d0de6 into facebook:master Mar 15, 2014
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.

4 participants