-1

I'm getting the following error while using JSONDecodable in swift4. "Type UserRegister does not confirm to protocol 'Decodable' "

My Model Structure looks like this.

struct UserRegister: Decodable {
    let id : NSInteger
    let name : String?
    let email : String?
    let cities : Array<Any>?
    let tax : [tax]
    let username : [username]
}

struct tax : Decodable {
    let deviceId : NSInteger?
    let financialYear : String?
    let country : String?
    let name : String?
    let state : String?
    let taxCode : String?
    let value : NSInteger? 
}

struct username : Decodable {
    let email : String?
    let phone : String?
}
Zac24
  • 2,514
  • 1
  • 23
  • 28

1 Answers1

1

The problem is the Array<Any>. You need an array of some Decodable type, such as String or Int.

matt
  • 515,959
  • 87
  • 875
  • 1,141