matthewcheok / JSONCodable

Hassle-free JSON encoding and decoding in Swift
MIT License
602 stars 66 forks source link

JSONString: line 19 tries casting to AnyObject while return type of the toJSON method is Any #54

Closed Cyfirr closed 8 years ago

Cyfirr commented 8 years ago

Hi Matthew,

excuse me if I am wrong (I am fairly new to Swift), but it seems to me that this line is a problem in JSONString(line 19):

let json = try toJSON() as! AnyObject

I understand that you use it later for NSJSONSerialization, but toJSON returns Any which cannot be casted toAnyObject.

Is it a bug of the Codable library or do you have any workaround in mind?

Thanks, Anatoli

matthewcheok commented 8 years ago

Yup the API for NSJSONSerialization changed with the release of Swift 3. There'll be a compatible release soon! @Nadohs

Cyfirr commented 8 years ago

Sorry, using forked version, not exactly a case here. Can be safely closed. Thanks for the answer!