Quantcast
Channel: Combine: Asynchronous Programming with Swift - Kodeco Forums
Viewing all articles
Browse latest Browse all 26

[Combine]throttle bug?

$
0
0
let subject = PassthroughSubject<String, Never>()

let throttled = subject.throttle(for: .seconds(10), scheduler: DispatchQueue.main, latest: false)

throttled.sink(receiveValue: {print($0, Date())})
    .store(in: &subscriptions)

subject.send("a")
subject.send("b")
subject.send("c")

DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
    subject.send("d")
}

should only output “a”, but why in playground. “d” also can be output.

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 26

Trending Articles