You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33-3Lines changed: 33 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ Clone the repository and drop in the .h and .m files from the "Classes" director
28
28
JSONAPI is available through [CocoaPods](http://cocoapods.org), to install
29
29
it simply add the following line to your Podfile:
30
30
31
-
pod 'JSONAPI', '~> 0.1.1'
31
+
pod 'JSONAPI', '~> 0.1.2'
32
32
33
33
## Usage
34
34
@@ -41,6 +41,8 @@ it simply add the following line to your Podfile:
41
41
#### Resource mappings
42
42
`(NSDictionary*)mapKeysToProperties` can be overwritten to define a dictionary mapping of JSON keys to map into properties of a subclassed JSONAPIResource. Use a "links." prefix on the JSON key to map a linked JSONAPIResource model or array of JSONAPIResource models
43
43
44
+
##### Usage
45
+
44
46
````objc
45
47
46
48
@implementationASubclassedResource
@@ -59,6 +61,34 @@ it simply add the following line to your Podfile:
59
61
60
62
````
61
63
64
+
##### Map values outside of `mapKeysToProperties` method
65
+
If you need to map values that are a little odd, like mapping to enums or performing some sort of formatting before setting a property, you can override the `initWithDictionary` method and assign properties in there.
66
+
67
+
````objc
68
+
69
+
typedef enum {
70
+
JESSE,
71
+
CHESTER
72
+
} Character;
73
+
74
+
@property (nonatomic, assign) Character character;
0 commit comments