Ahmed-Ali / JSONExport

JSONExport is a desktop application for Mac OS X which enables you to export JSON objects as model classes with their associated constructors, utility methods, setters and getters in your favorite language.
Other
4.79k stars 794 forks source link

Build- time error in xcode 9.2 "No 'decodeIfPresent' candidates produce the expected contextual result type 'AnyObject?" #105

Closed ankushkushwaha closed 5 years ago

ankushkushwaha commented 6 years ago

I generated the Model classes from JSON. Apparently, tool has generic type as 'AnyObject'. If some fields has null value in JSON, it will be exported as 'AnyObject' for Swift- struct -Codable format.

Problem: Xcode 9.2 does not allow to build the project with 'AnyObject' type properties in Codable structs. I am getting the following build time error:

No 'decodeIfPresent' candidates produce the expected contextual result type 'AnyObject? screen shot 2018-02-21 at 2 53 33 pm