Doubles and Ints come out as nil - also problems with sorting

Hi,
I am using the following code to extract my classes from my database but when I try and iterate though the classes, strings are fine but ints and doubles always have a nil value. Any ideas why?
Also what is the correct code for swift for sorting queries? I checked the web docs and it only has the java code.
class Menu : NSObject {
var objectId : String?
var itemTitle : String?
var itemPrice : Double?
var itemDetails : String?
var itemHot : Bool?
var itemVegan : Bool?
var itemVege : Bool?
var itemGlutenFree : Bool?
var itemOffer : Bool?
var itemOfferPrice : Double?
var extraCategory : String?
var itemCategory : String?
}
Types.tryblock({ () -> Void in

let query = BackendlessDataQuery()
let menu = self.backendless.persistenceService.of(Menu.ofClass()).find(query)

let currentPage = menu.getCurrentPage()

menuArray = currentPage as! [Menu]
print(menuArray.count)
}) { (exception) -> Void in

print(“menu failed.”)

}
This is the line that returns nil :
menuArray[indexPath.row].itemPrice
Thanks

Hi Will,

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
}

Regards,
Slava