Search code examples
iosobjective-ccoding-style

What would be the cleaner version of the code?


Team mate has written,

return ( jsonDict == nil ? nil : [jsonDict mutableCopy] );

What would be the cleaner version of the code in Objective-C?


Solution

  • Simply return [jsonDict mutableCopy];

    If jsonDict is nil than calling mutableCopy will also produce nil