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)
Post
Replies
Boosts
Views
Activity
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?