cancellables.forEach(\.cancel)
Shouldn't this be:
cancellables
.map(\.cancel) // Get unapplied method reference
.forEach { $0() }
cancellables.forEach(\.cancel)
Shouldn't this be:
cancellables
.map(\.cancel) // Get unapplied method reference
.forEach { $0() }
Unless there's someone else somehow holding a reference to the same cancellables (which to me would seem like a code smell), then I think you'd achieve the same by simply calling just cancellables.removeAll(), no?
Cancelling is not removing.
I was referring to this:
An
AnyCancellableinstance automatically callscancel()when deinitialized.