AnyCodable icon indicating copy to clipboard operation
AnyCodable copied to clipboard

NSNUmber is converting to Bool

Open filipepereira-ag opened this issue 2 years ago • 1 comments

When dictionary contains an NSNumber as 0 or 1, encodable method is mapping to true or false because 0 or 1 is also a boolean for swift.

I think this bug was introduced in #69 because NSNumber condition was removed from the first switch statement.

Example:

var dictionary = [
     "int": NSNumber(0)
] 

AnyEncodable is returning ["int": false]. This problem only happens from version 0.6.5.

filipepereira-ag avatar May 24 '23 11:05 filipepereira-ag

I'm running into the same issue

pedrommcarrasco avatar Sep 20 '24 09:09 pedrommcarrasco