Wednesday, February 8, 2023
HomeiOS Developmentios - Swift Mix: `sink` works with mannequin.$identify however not with mannequin.identify.writer....

ios – Swift Mix: `sink` works with mannequin.$identify however not with mannequin.identify.writer. Why?


I’ve the a mannequin with a broadcast identify property:

@MainActor class MyModel:ObservableObject {
    
    @Revealed non-public(set) var identify = ""

    ....

}

I’m questioning why sink works when used on mannequin.$identify and never on mannequin.identify.writer.

mannequin.$identify
    .obtain(on: RunLoop.fundamental)
    .sink { identify in
        ....            <-- it is referred to as. works.
    }
    .retailer(in: &subs)

This doesn’t get referred to as:

mannequin.identify.writer
    .obtain(on: RunLoop.fundamental)
    .sink { identify in
        ....            <-- doesn't get referred to as.
    }
    .retailer(in: &subs)

Can somebody clarify precisely why I’ve to make use of the $ register entrance of identify and why identify.writer doesn’t work?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments