Avatar
@swift-5.6.3 @swift-5.7.3 import Foundation struct Test { var text: String } class Model: ObservableObject { @MainActor @Published var list: [Test] = [] init() { Task { let updatedList = [ Test(text: "Text1"), Test(text: "Text2") ] for updated in updatedList { if let i = await self.list.firstIndex(where: { $0.text == updated.text }) { await MainActor.run(body: { self.list[i].text = "Changed" }) } } } } }