Skip to content

Instantly share code, notes, and snippets.

Embed
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)));
va_end(args);
return [selectors componentsJoinedByString:@"."];
}
@pitiphong-p

This comment has been minimized.

Copy link
Owner Author

commented Feb 7, 2019

An archive of my NSHipster Reader Submissions of 2014
https://nshipster.com/new-years-2014/#creating-a-keypath-from-selectors

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.