-
Notifications
You must be signed in to change notification settings - Fork 806
Added Find Owning View Controller command #13
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
Conversation
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' |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
. 👍
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.
I think I've addressed all the comments. Please let me know if I've missed anything or if you notice any issues! |
Looks great, thanks! |
Added Find Owning View Controller command
Shortcut is
fovc
. Given an inputUIView
this command will walk the nextresponder chain until it finds the
UIViewController
that owns this view.