Let’s say you are using the built-in .store(in:)
method on AnyCancellable
like so:
example(of: "removeDuplicates") {
// 1
let words = "hey hey there! want to listen to mister mister ?"
.components(separatedBy: " ")
.publisher
// 2
words
.removeDuplicates()
.sink(receiveValue: { print($0) })
.store(in: &subscriptions)
}
If you have an app that does this a lot - are these removed when the publishers complete?
I assume not - but wanted to double check. It also seems that this storage wouldn’t be thread-safe, correct?