Sequence Publishers with Swift Combine

Combine offers Publishers.Sequence as a way to create a Publisher out of an array of objects. This is helpful when you want to perform batch operations on several items, but the API your using doesn't support collections.

Here is an example of how to use Publishers.Sequence to modify an Item into a DifferentItem:

Publishers.Sequence<[Item], Never>(sequence: items)
    .flatMap { item -> AnyPublisher<DifferentItem, MyServiceError> in
        MyService.singleItemProcess(item: item)
    }
    .collect()