I want to fetch JSON data from my server and manipulate it upon launch. In Objective-C, I have used this #define code to convert NSNull to ni
#define
NSNull
ni
I would recommend, instead of using a custom conversion function, just to cast the value using as?:
as?
people.age = peopleDict["age"] as? Int
If the value is NSNull, the as? cast will fail and return nil.
nil