• 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"		: OSRKeyPath(AUser*, Id),
		@"photos"	: OSRTransform(OSRKeyPath(AUser*, pictures)),
		@"whatevs"	: OSRAdapt(OSRKeyPath(AUser*, whatever), AWhateverClass)
	};
}

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