Posts

Post marked as solved
8 Replies
for anyone else who experienced my particular issue. I noticed this with the following scenario. long story short .tag(step.id) (where step is a core data object) was creating issues on creation and deletions. to this day. no idea why ScrollViewReader { reader in       VStack(spacing: 0) {        HStack { Spacer() }        ForEach( (cycle.steps!.array as! [Step]), id: \.self) { step in         let index = cycle.steps!.index(of: step)                   StepRowLines(          step: .constant(step),          index: index + 1,          stepCase: StepRowLines.ofStepCase(index: index, size: cycle.steps?.count ?? 0),          deleteStep: deleteStep,          onTap: onTap,          highlight: timeManager.step == index         )         .animation(.default)         .transition(AnyTransition.slide.combined(with: .opacity).animation(.easeInOut))         .id(step.id)         .tag(step.id)        }       }       .onChange(of: timeManager.step) { idx in        let index = idx >= 0 ? idx : 0        withAnimation(Animation.easeIn(duration: 0.5)) {         reader.scrollTo((cycle.steps?.array as! [Step])[index].id, anchor: UnitPoint.init(x: 100, y: 0.66))        }       }      }