Ios swift – Unit testing a published variable
I have a set up like this: class ViewModel: ObservableObject { @Published var data: [Int] = [] func fetchData() { someAPICall() { result in data = result // Assume 10 items get inserted here } } } I write a…