Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Creating a KeyPath from Selectors
inline NSString * PTPKeyPathForSelectors(SEL selector, ...) {
if (!selector) {
return nil;
NSMutableArray *selectors = [NSMutableArray array];
va_list args;
va_start(args, selector);
SEL arg = selector;
do {
[selectors addObject:NSStringFromSelector(arg)];
} while((arg = va_arg(args, SEL)));
return [selectors componentsJoinedByString:@"."];

This comment has been minimized.

Copy link
Owner Author

commented Feb 7, 2019

An archive of my NSHipster Reader Submissions of 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.