Open
Description
Hi folks,
So I have the following:
public func mergedMovies(ids movieIDs: [String]) -> AnyPublisher<[Movie], APIError>{
let movieIDs = Array(movieIDs.prefix(20))
precondition(!movieIDs.isEmpty)
let initialPublisher = movie(id: movieIDs[0])
let remainder = Array(movieIDs.dropFirst())
#if canImport(Combine)
return remainder.reduce(initialPublisher) { combined, id in
return combined
.merge(with: movie(id: id))
.eraseToAnyPublisher()
}
#else
return remainder.reduce(initialPublisher) { combined, id in
return combined
.merge(with: movie(id: id))
.eraseToAnyPublisher()
}
#endif
}
I am getting two errors:
value of type 'Any' has no member 'eraseToAnyPublisher'
.eraseToAnyPublisher()
and,
value of type 'AnyPublisher<[Movie], APIError>' has no member 'merge'
.merge(with: movie(id: id))
Not sure where ocombine
should reside to resolve that, if that is the fix.
Thanks