post-processing of object after it's mapped

9 views
Skip to first unread message

Dan Morrow

unread,
Feb 12, 2015, 4:35:28 PM2/12/15
to res...@googlegroups.com
I'm getting an object in JSON that looks like this:

{
  quantity
: 4,
  value
: 6
}


My object looks like this:

class SpecialObject: NSObject {
@property (nonatomic, strong) NSNumber* quantity;
@property (nonatomic, strong) NSNumber* value;
@property (nonatomic, strong) NSString* specialValue;
}

I have an RKObjectMapping set up, and it creates my object, and it all works great. However, what I really want to do is set "specialValue" here, if it doesn't exist. The key here, is that I'd like to do this right after the object has mapped all the available fields from the JSON. Mainly, because I want "specialValue" to be computed from "quantity" and "value".

Having trouble figuring out how to do this, but it seems like there must be a way. I'd like for this object to get modified before it's returned from a "getObjects" call. Is that possible?
Reply all
Reply to author
Forward
0 new messages