因为List、ForEach和CoreData是我认为的三个主要罪魁祸首......好吧,如果不只是.transition()它本身的话。
基本上,我想要一个存储在核心数据中的任务列表,并且在点击任务时,它就会随着.transition(.scale). 我尝试过的几种潜在解决方案在画布和模拟器中都失败了,其中两个是堆栈溢出:
其余的尝试只是将 插入.transition(.scale)到所有可能的位置,并且有/没有.animation(...)附加。
这是我的错误视图的基本结构:
struct DeadlineListView: View {
@FetchRequest(entity: Deadline.entity(),
sortDescriptors: [NSSortDescriptor(keyPath: \Deadline.dueTime, ascending: true)],
predicate: NSPredicate(format: "isCompleted == false"),
animation: Animation.linear(duration: 2)
) var deadlineList: FetchedResults<Deadline>
// some other vars...
var body: some View {
VStack(spacing: 0.0) {
HStack {
// some other views...
}
// --- Where things matter most ---
List …Run Code Online (Sandbox Code Playgroud)