Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
func getAllData() -> AnyPublisher<[MyData], Error> {
getIDs().flatMap { ids -> AnyPublisher<[MyData], Error> in
let publishers = ids.map { self.getData(with: $0) }
return Publishers.Sequence<[AnyPublisher<MyData, Error>], Error>(sequence: publishers)
.flatMap { $0 }
.collect()
.eraseToAnyPublisher()
}.eraseToAnyPublisher()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.