• A trio of useful macros to help handling the reflection mappings and transforms.
- OSRKeyPath is inspired by EXTKeyPathCoding (from libextobjc), however it does away with the leading '@' to avoid hidden calls to +[NSString stringWithUTF8String:], simplifies it to always take (instance, key.path) arguments, and expands it to take a (class) type instead of an existing instance, making it usable in class methods without resorting to clunky workarounds.

Here's an example:

+ (NSDictionary *)reflectionMapping
{
	return @{
		@"id"		: KeyPath(TUser*, Id),
		@"photos"	: OSRTransform(OSRKeyPath(TUser*, pictures)),
		@"wharves"	: OSRAdapt(OSRKeyPath(TUser*, whatever), TWhateverClass)
	};
}

- (void)reflectionTranformsValue:(id)value forKey:(NSString *)propertyName
{
	if ([propertyName isEqual:OSRKeyPath(self, pictures)]) {
		self.pictures = [TPicture objectsFromDicts:value];
	}
}