concise [weak self]

Here’s the code if you want to experiment with it:

publisher.sink { [weak self] newValue in
    guard let self else { return }

    self.doSomething(with: newValue)
}.store(in: &cancellables)
Previous
Previous

guard statements

Next
Next

omit return keyword