for Hi,
I am retrieving data from a web service in an URLSession and store all the entries to an array
self.warehouseOrders.append(warehouseOrder)
The array is used in another view as data source for a List() item but now I get this error message:
Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates.
My question is: where is SwiftUI expecting me to put the operator receive(on:)) to fix this?
I have kinda solved it by changing the code to
DispatchQueue.main.async {
self.warehouseOrders.append(warehouseOrder)
}
but I am not sure if that is the correct approach here?
See https://forums.developer.apple.com/thread/128068for more details on my code - I have actually posted this already there as a reply but for some reason it still gets moderated for almost 24 hours ...
Max