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)
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: