2

trying to convert ObjectMapper syntax to Swift 3.0:

class CustomJsonResponse: Mappable {

    var status: String?
    var response: String?
    var errorCode: CustomErrorCode?

    init() {

    }

    required init?(map: Map) {

    }

    func mapping(map: Map) {
        status <- map["status"]
        response <- map["response"]
        errorCode <- (map["error_code"], CustomErrorCodeTransform())
    }
}

class CustomChallengesResponse: CustomJsonResponse {

    var challenges: [CustomChallenge]?

    required init?(_ map: Map) {
        super.init(map: map)
    }

    override func mapping(map: Map) {
        super.mapping(map: map)

        challenges <- map["data.questions"]
    }
}

I am getting an error at:

required init?(_ map: Map) {
            super.init(map: map)
        }

"Required intializer must be provided by subclass of CustomJsonResponse"

What am I doing wrong here? Any pointers on this would be great. Thanks!

KexAri
  • 3,867
  • 6
  • 40
  • 80

1 Answers1

0

I think you are missing:

init() {
    super.init()
}
Bista
  • 7,869
  • 3
  • 27
  • 55