iOS RestKit, mapping with dependency on other keys -


i have unique data returned api represent correctly in models.

a sample response this:

{     'name' : 'mr. john smith',     'preferred_format' : 'first_name_only' } 

the model has 3 properties: name, preferred name, , preferred format. mapping should set

name = 'mr. john smith' preferred_name = 'john' preferred_format = enumpreferredformatfirstonly 

where enumpreferredformatfirstonly enumerated value. know json data odd, , know model odd, must follow these specs.

can restkit map properties (name , preferred_format), while setting preferred_name property, relies on other 2 properties?

i thinking of custom value transformer preferred_name nil key. need transformed value of preferred_format first.

no, magic.

you should add custom setter methods 2 properties can convert them desired enum , use enum , full name set preferred name.

a transformer complex use here isn't they're for.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -