Generic with 2 types

I have below Json format response from server. Note that "data" property can be a json object or array with json object. My purpose is define a model using generic to parse the json response. I'm using ObjectMapper for parsing Json.

// Json data format
  "code": 0,
  "data": {} or []
  "message": "xxxx"

// Json Model
class MTNCommonResponse<T: Mappable>: Mappable {
  var code: Int?
	var data: T?
	var message: String?

// How Can I define the `T` as two Types like below
T: Mappable Or T: Sequence where T.Element: Mappable
1 Like