Swift class override classForCollectionProperty twice build error
ladmini opened this issue · comments
李竹 (Zhu Li) commented
Hi guys, Thank you very much to bring me a so powerful library. It works well in swift.
But I found a problem. Could you please help me?
I have a Response model like this
class ResponseModel: JSONModel {
var status = ""
var message:[MessageModel] = []
override static func classForCollectionProperty(propertyName:String) -> AnyClass?{
switch propertyName {
case "message":
return MessageModel.self
default:
return nil
}
}
}
class MessageModel:JSONModel{
}
I also have a Submodel of ResponseModel like this
class LocationModels: ResponseModel {
var model:[LocationModel] = []
override static func classForCollectionProperty(propertyName:String) -> AnyClass?{
switch propertyName {
case "model":
return LocationModel.self
default:
return super.classForCollectionProperty(propertyName: propertyName)
}
}
}
class LocationModel:BaseModel{
}
But this code compile failed. Because In swift the classForCollectionProperty method can only be override once.
So Could you please help to tell me how can I achieve this demand?