Cannot clear TextField when typing in a new value

I have a SwiftData object Set that has a non Optional reps and Weight and when my editView gets initialized I Set the existing sets to a State object:

    //The user will temporarily write to this sets array than after he is done we will save it to exercises
    @State var sets: [MySet]

        .onAppear {
            //this will check if the exercise has sets and if it does we will put them into State but if its doesnt we will create 2
            // exercise = exercise
            if let newSets = exercise.sets {    //unwrapping the passed exercises sets
                if (!newSets.isEmpty) {     //we passed actual sets in so set them to our sets
                   //Copy over all of those Sets into new Sets
                    sets = newSets
                    
                }
                else {      //the exercise had no sets meaning an empty array was passed so we fill it with our mock Sets
                    sets = [MySet(id: UUID(), weight: 0, reps: 0,isCompleted: false, exercise: exercise), MySet(id: UUID(), weight: 0, reps: 0, isCompleted: false, exercise: exercise)]
                }
                sortSets()
                
            }
            //The optional exercise sets array was empty so load default (0) sets into State
            else {
                sets = [MySet(id: UUID(), weight: 0, reps: 0,isCompleted: false, exercise: exercise), MySet(id: UUID(), weight: 0, reps: 0, isCompleted: false, exercise: exercise)]
                sortSets()
            }
        }

Then I iterate through this State of sets and bind the weight and reps to two TextFields:

  ForEach($sets){ $set  in
                        //HStack for Editing the Details of a Set
                        HStack(spacing: 10) {
                            Group {
                                if(set.isCompleted) {
                                    Image(systemName: "checkmark.circle.fill")
                                        .foregroundStyle(.green) // Using the custom color
                                        .font(.system(size: 22)) // Adjust the size here
                                    
                                } else {
                                    Image(systemName: "circle")
                                        .font(.system(size: 22)) // Adjust the size here
                                }
                            }
                            .onTapGesture {
                                if(set.reps != 0 && set.weight != 0) {
                                    set.isCompleted.toggle()
                                }
                            }
                            //Enter Reps and Weight
                            HStack {
                                VStack(alignment: .leading){
                                    Text("Kg")
                                        .foregroundStyle(.gray)
                                        .font(.subheadline)
                                    // I am having problems with these TextFields and its when im editting an old reps or weight i cant delete the number
                                    //already there to add a new one it wont let the reps of weight TextField Become empty
                                    TextField("\(set.weight)", value: $set.weight, formatter:Formatter.valueFormatter)
                                        .keyboardType(.decimalPad)
                                }
                                .frame(width: 45)
                                .padding(.leading)
                                //.background(.yellow)
                                
                                //Enter Reps
                                VStack(alignment: .leading) {
                                    Text("Reps")
                                        .foregroundStyle(.gray)
                                        .font(.subheadline)
                                    TextField("\(set.reps)", value: $set.reps,formatter:Formatter.valueFormatter)
                                        .keyboardType(.decimalPad)
                                    
                                    
                                    
                                }
                                .frame(width: 45)
                                //.background(.blue)
                            }
                            
                            Spacer()
                            
                            //Button to dublicate the current set and add it to the list
                            //even this dupilicate button will allow me to make weight and reps 0 even thouhg its a complete copy of another set,
                            //so why cant i make weight and reps of an existing Set 0?
                            Button {
                                print("Current sets count: \(sets.count)")
                                if(sets.count <= 7) {
                                    let weight = set.weight
                                    let reps = set.reps
                                    let newSet = MySet(id: UUID(),weight: weight, reps: reps, isCompleted: false, exercise: exercise)
                                    withAnimation {
                                        sets.append(newSet)
                                    }
                                }
                                
                                
                            }
                        label: {
                            Image(systemName: "plus.rectangle.on.rectangle")
                        }
                        .buttonStyle(.borderless)
                        }
                        
                        
                        
                    } 

Now the problem is that If the Set already has a Weight and Reps(i.e was added before we navigated to this view) I can't set it to 0 to change it i.e it has 5 reps I want to change it to 6 I cannot clear the 5 to write 6 it wont allow it to be cleared, strangely enough when I add a new set in the New Set button or even then I use the duplicate button to make an exact copy of the set(I can clear it zero for that duplicate one but not the original one)

Your explanations are a bit hard to follow… I cannot understand how all the objects relate to each others.

What happens ? When you have 6 in Reps and type a 7 you get 67 ? Is that it ?

Where do you expect the TextField to be cleared?

Did you try to do it here, with onTap ?

              VStack(alignment: .leading) {
                    Text("Reps")
                          .foregroundStyle(.gray)
                           .font(.subheadline)
                     TextField("\(set.reps)", value: $set.reps,formatter:Formatter.valueFormatter)
                                    .keyboardType(.decimalPad)
                        .onTapGesture {
                            set.reps = 0
                        }
                  }

Say the weight is 50 and I want to type 60, I start deleting the 50 I can delete the 0 but when I try to delete the 5 for it to be 00 the Textfield wont allow it, it wont allow me to clear all of the number from it, This behavior occurs only on Set that already existed in SwiftData the ones that got populated here:

 if let newSets = exercise.sets {    //unwrapping the passed exercises sets
                if (!newSets.isEmpty) {     //we passed actual sets in so set them to our sets
                   //Copy over all of those Sets into new Sets
                    sets = newSets
                    
                    
                }

If I were to do a exact copy of one of those sets:

 let weight = set.weight
                                    let reps = set.reps
                                    let newSet = MySet(id: UUID(),weight: weight, reps: reps, isCompleted: false, exercise: exercise)
                                    withAnimation {
                                        sets.append(newSet)
                                    }

The textfield of that set would behave completly normally I can clear it completely ( both the 5 and the 0 in 50)

This could be caused by the fact that I am using a Proxy Binding and the Set that already exist are In SwiftData already so clearing weight or reps means it tries to write nil to my weight and reps in my SwiftData class where they are not optional, is there any mechanism in TextField that can prevent this?

Cannot clear TextField when typing in a new value
 
 
Q