Open longv2go opened 6 years ago
Thanks for the pull request. I did something similar recently, but without the arguments. Have you tried wrapping the code in a function? Or alternatively, a class method or a category? For example:
@import ObjectiveC.runtime;
@implementation NSObject (ObjectProperties)
+ (NSArray *)propertyNames {
NSMutableArray *result = (id)[NSMutableArray array];
unsigned int count;
objc_property_t *props = (objc_property_t *)class_copyPropertyList(self, &count);
for (int i = 0; i < count; i++) {
char *name = (char *)property_getName(props[i]);
[result addObject:(id)[NSString stringWithUTF8String:name]];
}
return result;
}
@end
And then from lldb:
lldb> evalfile /path/to/test.m
lldb> po [UIView propertyNames]
evalfile command can evaluate a multiline source code from a file. You can also supply a argument after the file parameter.