I have a singleton that's in charge of handling user parameter changes for logic operations across my app. The parameters are divided into two types, "influencing" and "steering", and each is represented by a CurrentValueSubject.
In my central controller class I use CombineLatest to update all my parameters whenever either type of parameter changes. From the controller's init():
Publishers .CombineLatest( InteractionParameters.sharedInstance.influenceParameters, InteractionParameters.sharedInstance.steeringParameters ) .debounce(for: 0.3, scheduler: DispatchQueue.main) .sink { (influencing, steering) in print("influencing params: \(influencing), steering: \(steering)") } .store(in: &subscriptions) This works, in that I do get the changes as they're made by the user. But I always get all the parameters twice, in immediate succession — i.e., the output here is always printed twice. I've double-checked the debounce, which seems to work as expected — the value being sent twice is always the last value to hit the debounce.
I'm sure it's some simple mistake/misunderstanding, but not sure how to fix it.
Thanks in advance.
removeDuplicatesoperator.