I have a View with many Buttons and if the User tap on a Button the Viewmodel need to update the current Button with the increased value.
class ProductVM: ObservableObject {
    @Published var product : Product
    init(product: Product) {
        self.product = product
    }
    public func increaseAmount() {
        var myInt = Int(self.product.amount) ?? 0
        myInt += 1
        self.product.amount = String(myInt)
        print(myInt)
        print("...")
    }
}
the problem is the myInt is every time just 1 and the value can't be updated.
HOW can i update the value and save it in the current Model so that the View know its increased ??!!
struct singleButtonView: View {
@ObservedObject var productVM : ProductVM
func updatePos(){
    self.productVM.increaseAmount()
  }
 }
and i call it with
singleButtonView(productVM: ProductVM(product: product))
 
    