Type issue when using data from php with Swift

60 Views Asked by At

I try to fill a table view with data downloaded from my database with Alamofire. I created a new NSObject class as followed :

class Repas: NSObject {
    var date: String
    var choix: String
    var note: Int

    init(date: String, choix: String, note: Int) {
        self.date = date
        self.choix = choix
        self.note = note
        super.init()
    }
}

The downloaded date respect this model format but when I try to insert them I got an error: cannot assign a value of type 'String?' to a value of type '[Repas]'.

I tried to force casting but it doesn't work. I don't understand how I can access my data with this method.

0

There are 0 best solutions below