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

Proposal, add overlapping buffers. #2593

Open
danielt1263 opened this issue Apr 29, 2024 · 2 comments
Open

Proposal, add overlapping buffers. #2593

danielt1263 opened this issue Apr 29, 2024 · 2 comments
Assignees

Comments

@danielt1263
Copy link
Collaborator

danielt1263 commented Apr 29, 2024

I always thought it odd that the overlapping buffers which are offered in the core .NET Rx implementation and documented in the Introduction to Rx book are not part of RxSwift. I've had personal implementations that I wrote back in 2019, and I was thinking it would be nice to finally add them to the library. Maybe I should add them to the RxSwiftExt library instead?

What do you all think?

@freak4pc
Copy link
Member

Can you share how that use case would look? Maybe example input / output so
I can better understand ?

In general the aim of the library is to add mainly useful operators and not just theoretically useful ones so would be great finding the use case for such a new operator

Thanks for the suggestion!

@danielt1263
Copy link
Collaborator Author

There is an example in the book (that I linked, but you have to scroll down a ways) that uses an overlapping buffer to calculate the average speed of a vessel, and I've used it for that sort of thing in the past.

I have also used it to smooth out jitter while reading the accelerometer input.

Lastly, an overlapping buffer comes in handy when you want the two most recent values emitted from an observable. It's cleaner than doing the whole share/skip/zip dance. Instead, you just do .buffer(count: 2, skip: 1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants