As @OOPer indicated, using an object is a way around the problem:
I needed to use this to avoid the expensive copies.
swift
final class Container: ObservableObject {
private var cow = CowType()
var values: [Int] { cow.values }
func append(_ value: Int) {
objectWillChange.send()
cow.append(value)
}
}
Interestingly, @Published runs into the same problem as @State, making a copy at every iteration. e.g.,
swift
final class Container: ObservableObject {
@Published var cow = CowType()
}
This makes cow make a copy every time it is mutated.
Post
Replies
Boosts
Views
Activity
UPDATE:
On the second inspection, making CowType Equatable does not fix the issue.
On the Swift.org forum, Jonathan Hise Kaldma thought that making CowType Equatable might solve the problem. It was a good thought, but didn't work out in this case.
I think you can async let to kick off the tasks and then await a tuple of results.
Your LineMark is missing series. I think if you put that in it will break it into multiple plots like you want.