glideapps / quicktype-xcode

Xcode extension to paste JSON as Swift, Objective-C, and more
https://quicktype.io
Apache License 2.0
1.68k stars 53 forks source link

Generates deprecated code #45

Closed w8HAQRHkTx7r closed 5 years ago

w8HAQRHkTx7r commented 5 years ago

This JSON

[{"faceId":"5eeb5ca8-88ab-47e3-a0e1-a72b43739ca0","faceRectangle":{"top":131,"left":177,"width":162,"height":162},"faceAttributes":{"smile":0.001,"headPose":{"pitch":-5.7,"roll":-9.1,"yaw":-34.1},"gender":"female","age":22.0,"facialHair":{"moustache":0.0,"beard":0.0,"sideburns":0.0},"glasses":"NoGlasses","emotion":{"anger":0.0,"contempt":0.0,"disgust":0.0,"fear":0.0,"happiness":0.001,"neutral":0.987,"sadness":0.001,"surprise":0.01},"blur":{"blurLevel":"low","value":0.06},"exposure":{"exposureLevel":"goodExposure","value":0.67},"noise":{"noiseLevel":"low","value":0.0},"makeup":{"eyeMakeup":true,"lipMakeup":true},"accessories":[],"occlusion":{"foreheadOccluded":false,"eyeOccluded":false,"mouthOccluded":false},"hair":{"bald":0.02,"invisible":false,"hairColor":[{"color":"brown","confidence":1.0},{"color":"red","confidence":0.49},{"color":"blond","confidence":0.47},{"color":"black","confidence":0.19},{"color":"gray","confidence":0.12},{"color":"other","confidence":0.03}]}}}]

generated this code: public var hashValue: Int { return 0 }

which displayed this error: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'JSONNull' to 'Hashable' by implementing 'hash(into:)' instead

in a Playground in Xcode 10.2.1

w8HAQRHkTx7r commented 5 years ago

Found the option to generate swift 5