Using Apple\'s new Combine framework I want to make multiple requests from each element in a list. Then I want a single result from a reduction of all the the responses. Basical
Try something like this if order is important:
func createIngredients(ingredients: [Ingredient]) -> AnyPublisher<[CreateIngredientMutation.Data], Error> {
// first attempt
let results = ingredients
.map(createIngredient)
// results = [AnyPublisher]
var resultPublisher = Empty
for result in results {
resultPublisher = resultPublisher.append(result)
}
return resultPublisher.collect()
}