struct myOrdesItems: Decodable {
let userFName: String?
let userLName: String?
let userOrderPreSerial: String?
let userOrderSerial: Int?
let userOrderProductsValue: Int?
let userOrderOrderedDate: String?
let payTypeDescEN: String?
let listUserOrderStatus : [listUserOrderStatus]
let listUserOrderShipmentVM: [listUserOrderShipmentVM]
}
struct listUserOrderStatus: Decodable {
let userOrderStatusTitleEN: String?
let userOrderStatusID: Int?
}
struct listUserOrderShipmentVM: Decodable {
let userOrderStatusTimeLine: [userOrderStatusTimeLine]
}
struct userOrderStatusTimeLine: Decodable {
let userOrderStatusID: Int?
}
var myorderArray : [myOrdesItems] = []
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if tableView.tag == 10 {
return myorderArray.count
} else {
for number in 0..<(myorderArray.count) {
let value = myorderArray[number].listUserOrderShipmentVM.count
print(value)
arrayOfElement.append(value)
}
return arrayOfElement.count
}
}
答案 0 :(得分:0)
我想这就是您要的
if tableView.tag == 10 {
return myorderArray.count
} else {
return myorderArray.flatMap{$0.userOrderShipmentVMArray}.count;
}
编辑
更改
let listUserOrderShipmentVM: [listUserOrderShipmentVM]
到
let userOrderShipmentVMArray: [listUserOrderShipmentVM]