ReactiveCocoa中的@keypath如何运作?

时间:2016-11-07 01:12:57

标签: reactive-cocoa

ReactiveCocoa 2.0中的@keypath如何运作?

[_ self setValue:@(propertyValue)forKey:@keypath(MyClass.new,property)];

#define keypath(...) \
    metamacro_if_eq(1, metamacro_argcount(__VA_ARGS__))(keypath1(__VA_ARGS__))(keypath2(__VA_ARGS__))

#define keypath1(PATH) \
    (((void)(NO && ((void)PATH, NO)), strchr(# PATH, '.') + 1))

#define keypath2(OBJ, PATH) \
    (((void)(NO && ((void)OBJ.PATH, NO)), # PATH))

0 个答案:

没有答案