I have a table with a Boolean column. When I use a mapped class to this data type in Swift, with Bool? fields, they are always nil regardless of the column value in the cloud.
If I use NSNumber? datatypes in the Swift code they work.
But Boolean columns can be null in the database, so shouldn’t they be nullable on the client too. Are you saying that you can’t use nullable Boolean columns. I have been using them in Parse as a trip state, where null means something different from both true and false.
You shouldn’t use Bool?, Int?, Double?, Float? in your data model classes.
Foundation provides a bridge from Bool to NSNumber (as well as bridges for Int, Double, etc.), but it does not provide a bridge for Bool? , etc. That’s why it is not visible to Objective-C (Backendless SDK is implemented in Objective-C).
So, this is WRONG class:
class WrongNumerics : NSObject {
var logic : Bool?
var count : Int?
var real : Double?
var afloat : Float?
}
and here is RIGHT class:
class RightNumerics : NSObject {
var logic : Bool = false
var count : Int = 0
var real : Double = 0.0
var afloat : Float = 0.0
}