As I understand it, SwiftyJSON wants to allow for fuzzy types, because that's how javascript works too, right? I like that, but I don't like how that's implemented.
Right now, .int returns an optional int, which is nil if the value is not a real int. And .intValue provides an int no matter what, which means is tries to convert other values to int values and if that's not possible then it returns a 0.
The thing I don't like about .intValue is that if I get a 0 back, that I don't know if the value wasn't a valid integer, or if the value was in fact a 0. I would like to have a feature that's a bit in between these two features. I would like something that tries to convert the value to an int, and if that's not possible, to return a nil.
Does anyone else like this idea?
As I understand it, SwiftyJSON wants to allow for fuzzy types, because that's how javascript works too, right? I like that, but I don't like how that's implemented.
Right now,
.intreturns an optional int, which is nil if the value is not a real int. And.intValueprovides an int no matter what, which means is tries to convert other values to int values and if that's not possible then it returns a 0.The thing I don't like about
.intValueis that if I get a0back, that I don't know if the value wasn't a valid integer, or if the value was in fact a 0. I would like to have a feature that's a bit in between these two features. I would like something that tries to convert the value to an int, and if that's not possible, to return a nil.Does anyone else like this idea?