Coder Social home page Coder Social logo

Comments (9)

stephencelis avatar stephencelis commented on May 22, 2024 1

And no prob! Thanks for making this resource! Think it'll help a lot of folks.

from rxswift-to-combine-cheatsheet.

freak4pc avatar freak4pc commented on May 22, 2024

Thanks about the first one - regarding the second one, I guess we could add it, even though it's more like comparing

ifEmpty(default: observable) 
 .switchLatest()

in RxSwift - it's not really a 1v1 operator comparison. What do you think?

from rxswift-to-combine-cheatsheet.

freak4pc avatar freak4pc commented on May 22, 2024

Ok I resolved both in 3f18df3

from rxswift-to-combine-cheatsheet.

stephencelis avatar stephencelis commented on May 22, 2024

I think it's useful to show solutions even if they're more verbose. Could use a ⚠️ to distinguish operators that aren't 1:1 mappings. Same as "flatMapLatest" which isn't really "switchToLatest" since there's no transform. You're stuck with something like "map { … return publisher }.switchToLatest()".

from rxswift-to-combine-cheatsheet.

freak4pc avatar freak4pc commented on May 22, 2024

I've added it in the note instead as a direct mapping - felt better to me. The warning sign thing is also interesting, I'll give it some though :) Thank you!

from rxswift-to-combine-cheatsheet.

stephencelis avatar stephencelis commented on May 22, 2024

Could also add a note that startWith(value) is merge(with: Publishers.Just(value))

from rxswift-to-combine-cheatsheet.

freak4pc avatar freak4pc commented on May 22, 2024

I'm worried about adding all these composition hacks but I guess if we want to provide a good bridge, it should be there.

It would be the same as using prepend with a Just in Combine, but that's more comparable to Observable.concat(.just("value"), stream) then startWith. Not too sure on where to put the line :)

from rxswift-to-combine-cheatsheet.

stephencelis avatar stephencelis commented on May 22, 2024

Oh neat! Haven't explored enough to see prepend yet. Looks like prepend can be used the same way startWith is used, no? So could be considered a direct map.

from rxswift-to-combine-cheatsheet.

freak4pc avatar freak4pc commented on May 22, 2024

Actually seems to be :) I hadn't noticed before but prepend has one overaload that takes a variadic array, and one that takes a different stream (like concat).

from rxswift-to-combine-cheatsheet.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.