I am showing a tableview with the list generated using the following code. The UI is properly populated. However on did select method, the call is not matched inside the generic case.
@objc public protocol ListProtocol {}
class EmptyListProtocol:ListProtocol {
let message:String
init(message:String){
self.message = message
}
}
class ListItemStrategy<T>: ListProtocol{
let object:T
init(listitem:T) {
self.object = listitem
}
}
struct CartInfo {
let card_id : String
let productname: String
let purchasedate:String
}
struct ProductOnSale {
let product_id:String
let product_name:String
let store_id:String
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let item = self.tablelist[indexPath.row]
switch item {
case is ListItemStrategy<Any>:
print("didtap")
case is EmptyListProtocol: break
default:
break
}
}
var table list : [ListProtocol] = []
I am not able to detect in particular, if a cart is selected or new purchase product is selected.