Skip to content

Missing .merge and .throttle #141

Open
@doronkatz

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

Metadata

Assignees

Labels

missing functionalityThis functionality is present in Apple's Combine but we don't have it yet

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions