apple / apple/swift-async-algorithms
Seeking Help to Replace RxSwift's distinctUntilChanged with Swift Concurrency Equivalent
- Dominant language
- Swift
- Stars
- 3.7k
- Forks
- 226
- Avg merge
- 10d 3h
- Merged PRs (30d)
- 1
Description
Hello,
I have been working on converting code from RxSwift to Swift Concurrency since last week and have successfully transitioned some parts. However, **I am currently looking for a way to replace the distinctUntilChanged operator defined in RxSwift with an equivalent in Swift Concurrency.**
Yesterday, I came across this library and am curious to know if it offers a suitable replacement for the distinctUntilChanged operator.
Could anyone advise how I might achieve this using this library? Any suggestions would be greatly appreciated.
For your reference, here is the code snippet where I'm using the distinctUntilChanged operator that I would like to replace:
```Swift
// *The code below is just an example.
Observable
.combineLatest(APIRequest1(), APIRequest2())
.distinctUntilChanged { old, new -> Bool in
let (oldResponse1Tuple, oldResponse2Tuple) = old
let (newResponse1Tuple, newResponse2Tuple) = new
let oldResponse1: [CustomType] = oldResponse1Tuple.0
let oldResponse2: [CustomType] = oldResponse2Tuple.0
let newResponse1: [CustomType] = newResponse1Tuple.0
let newResponse2: [CustomType] = newResponse2Tuple.0
return (oldResponse1 == newResponse1) && (oldResponse2 == newResponse2)
}
.subscribe(onNext: { [weak self] in
//...
})
.disposed(by: disposeBag)
```
Contributor guide
Research direction
The issue names no repository file, test, or entry point. Start by checking the library's existing algorithm APIs for a Swift Concurrency equivalent to RxSwift's distinctUntilChanged, then establish the expected behavior and tests before deciding whether work is needed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100