Wednesday, September 30, 2026
HomeiOS Developmentios - Is there any method to forestall a writer's sink block...

ios – Is there any method to forestall a writer’s sink block if the worth hasn’t modified?

[ad_1]

I’ve this code:

someRepository.selectedValuesPublisher
    .sink { [weak self] _ in
        self?.doSomething()
    }.retailer(in: &cancelSet)

Right here is how I declare the writer

@Printed var selectedValues: EatingPreferencesSelectedValues
var selectedValuesPublisher: Printed<EatingPreferencesSelectedValues>.Writer { $selectedValues }

whereas selectedValues is a customized object that comprises 3 enums;

valueA: someEnum
valueB: someEnum
valueC: someEnum

My predominant difficulty is that I wish to invoke doSomething() simply in case the brand new worth of selectedValuesPublisher has been modified.

What’s the greatest strategy to that?

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments