I have a fairly complicated ObservedObject with the following setup:
class ThreadDataStore: ObservableObject {
@Published var childCommentList: [Int]
@Published var childComments: [Int: CommentDataStore]
}
View: some View {
ForEach(threadDataStore.childCommentList, \.self) { id in
CommentView(comment: childComments[id]!)
}
}
When I have let's say 100-200 comments, then each loading becomes slower and slower.
Is the way I'm setting up my ObservableObjects not intended?
Post
Replies
Boosts
Views
Activity
This is a question I've been dealing with and don't know whether or not it is "intended" or being worked on atm.
Basically I've found that when you append items to a List that triggers the List to immediately re-evaluate all pre-existing items in the List (unnecessarily). While re-evaluation as I'm told is not really that expensive if the List has 1000 items there is still a decent amount of overhead that this cause.
Am I using List the wrong way or is Apple working on optimizing aspects of SwiftUI like this?