Post not yet marked as solved
I am sorry. I didn't mean to confuse or hide info. It's just that I didn't want to flood with too many code lines.
Post not yet marked as solved
I was starting to implement your solution in func tableView, and I wonder now if I am not going to create a conflict with the existing cell commands (lines: 23 and 24) ???override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// Dequeue Cell Version avec style Custom et Grouped
let cell = tableView.dequeueReusableCell(withIdentifier: "productCell", for: indexPath) as! ProductTableViewCell
// Configure the cell
let header = headers[indexPath.section]
// Affichage différent suivant critère de tri choisi
var uneSérie = ProductTableViewCell.PetitHeader(itemGauche: header.série[indexPath.row].providerName, itemCentre: header.série[indexPath.row].sérieName, itemDroit: header.série[indexPath.row].sérieStartDate)
// Récupération de l'index du row traité pour lecture products
var indexCourant: Int = 0
let product = products[indexCourant]
// Affichage des données
cell.updateCells(with: uneSérie)
// Affichage du bouton Buy
cell.product = product
cell.buyButtonHandler = { product in MyBridgeStoreProducts.store.buyProduct(product)
}
cell.showsReorderControl = true
return cell
}
Post not yet marked as solved
That's probably why it works for the Builder but not in Run mode. I tried to move back to ProductTableViewCell the function downloadButtonTapped but it's impossible. There are too many other functions unknown in this VC. So as you said, I need to find another way to add target to the button. Looking at the addTarget () structure in XCode, I don't see other options. Do you have an example to offer ?There is also a removeTarget function. Would that help to remove the 'Buy' target before setting the "Download' (as both buttons are on the same Accessory) ?
Post not yet marked as solved
That doesn't work. Builder says : Use of unresolved identifier 'downloadButtonTapped'
Post not yet marked as solved
Merci...My answers :The func newDownloadButton is in ProductTableViewCell also.Crash happens when pressing the Download button.There is only one view (the List view). No transition.The downloadButtonTapped func is called as ProductTableViewController.downloadButtonTapped just because I copied from a similar piece of code (the one generating the Buy button at the same place). I thought these buttons were similar. That's no more than that to be honest. At the end of the day, what I am trying to achieve is just to replace the Buy button (for IAP) by a Download button (for saving the purchased product), then replace it by a Checkmark when product is purchased and saved. But I have no formal opinion on how to do it :-)