I am making an app where you can store a products name and its price in a Realm dataBase and show it in a UItableViewController and in another UITAbleViewController to show only the name of the product and if you press on the Cell, I want that the product name appends to an Array of Strings and the price of that product(which is not shown on that Particular cell) to be appended to another Array of Doubles. is that possible? if yes, how do I do that?
I searched on google and I found an answer on StackOverflow: getting data from each UITableView Cells Swift but his Answer didn't help, that is why I am writing this question.
I added this part of the answer to the question on stackOverFlow I mentioned above:
selectedProductsForSell.append(cell?.value(forKeyPath: item.name) as! String)
but I don't know how to append the connected price to another array
When I run the app on an iPad, when I tab the cell to append the value (what is the name of the product) to an array, it gives the following error:
terminating with uncaught exception of type NSException
and it goes to the appDelegate.swift
any ideas on how to solve this problem and any ideas to what I described above about the appending the name and the price?
thanks in advance! benji