From 3b5f174dd4d755d4591047dd21c44a7e08119897 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Sun, 4 Mar 2018 21:15:17 -0800 Subject: [PATCH] Make `paltrace` work on selected views Calling `_autolayoutTrace` prints the entire view tree, regardless of which view it's called on, but `_autolayoutTraceRecursively:` prints the tree of the view it's called on. --- commands/FBAutoLayoutCommands.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/commands/FBAutoLayoutCommands.py b/commands/FBAutoLayoutCommands.py index dc3a23e..c38ad4b 100644 --- a/commands/FBAutoLayoutCommands.py +++ b/commands/FBAutoLayoutCommands.py @@ -31,7 +31,9 @@ def args(self): def run(self, arguments, options): view = fb.evaluateInputExpression(arguments[0]) - print fb.describeObject('[{} _autolayoutTrace]'.format(view)) + opt = fb.evaluateBooleanExpression('[UIView instancesRespondToSelector:@selector(_autolayoutTraceRecursively:)]') + traceCall = '_autolayoutTraceRecursively:1' if opt else '_autolayoutTrace' + print fb.describeObject('[{} {}]'.format(view, traceCall)) def setBorderOnAmbiguousViewRecursive(view, width, color):