Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing .merge and .throttle #141

Open
doronkatz opened this issue Jan 6, 2020 · 12 comments
Open

Missing .merge and .throttle #141

doronkatz opened this issue Jan 6, 2020 · 12 comments
Assignees
Labels
missing functionality This functionality is present in Apple's Combine but we don't have it yet
Projects

Comments

@doronkatz
Copy link

doronkatz commented Jan 6, 2020

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

@broadwaylamb
Copy link
Member

Hi!

The reason is that merge and throttle are not implemented yet. merge is being worked on in #72.

@broadwaylamb broadwaylamb self-assigned this Jan 6, 2020
@broadwaylamb broadwaylamb added the missing functionality This functionality is present in Apple's Combine but we don't have it yet label Jan 6, 2020
@broadwaylamb broadwaylamb added this to To do in OpenCombine via automation Jan 6, 2020
@doronkatz
Copy link
Author

doronkatz commented Jan 6, 2020 via email

@andybest
Copy link

andybest commented Apr 7, 2020

Hi, I wondered if there has been any progress made on this?

Thanks :)

@broadwaylamb
Copy link
Member

Hi, I wondered if there has been any progress made on this?

Thanks :)

Hi. Nope, I’ve been really busy lately.

@maximkrouk
Copy link

Hi, I also wondered if there has been any progress made on this?

I'd like to implement ComposableArchitecture using OpenCombine, but is probably impossible without merge publishers 🙂

Thanks :)

@broadwaylamb
Copy link
Member

Nope, no progress. I hope I'll find some time in the coming months, but no promises.

@maximkrouk
Copy link

maximkrouk commented Mar 11, 2021

Btw it is implemented in CombineX, maybe this may help
Merge
MergeMany

@broadwaylamb
Copy link
Member

Unfortunately, the implementation is not that easy, there are many corner cases. I am pretty certain that the one that you refer to doesn’t handle them all, and is not tested very well.

@maximkrouk
Copy link

Any updates? 🙂

@broadwaylamb
Copy link
Member

Nope. Doing my best, sorry.

@Degtyarserg
Copy link

Degtyarserg commented Jul 15, 2021

Hi, I wondered if there has been any progress made on this?

Thanks 😉

@MaxDesiatov
Copy link
Collaborator

No updates on this, but all contributions that help us in the implementation are very welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
missing functionality This functionality is present in Apple's Combine but we don't have it yet
Projects
OpenCombine
  
To do
Development

No branches or pull requests

6 participants