i have a VC name RestaurantViewController
it has custom cell for itemName ItemPrice and there are three button + , - and add their actions are in customCellClass now when a user select the quantity by setting with plus/minus and then hit the add button the whole data should go to the CartVC
but not push until user selects the cart icon on main menu.
the RestaurantVC
looks like this
currently i'm using the blockClosure to pass data
//assign item name to cell
let selectedDictName = restMenu[indexPath.row] as! NSDictionary
print("the selected dict ", selectedDictName)
cell.itemNameLabel.text = selectedDictName.value(forKey: "ItemName") as! String
// assign item price to cell
let selectedDictPrice = restMenu[indexPath.row] as! NSDictionary
cell.itemPriceLabel.text = "Price: \(selectedDictPrice.value(forKey: "ItemPrice") as! String)"
// pass ItemName and ItemPrice by blockClosure
if blockClosure != nil{
blockClosure(selectedDictName.value(forKey: "ItemName") as! String, selectedDictPrice.value(forKey: "ItemPrice") as! String )
}
but this pass all values corresponding the selected restaurant at before loading the cell
how can i pass data and then further attach the item quantity with it? it will be very helpful for my final semester project