Last active
January 15, 2021 23:35
-
-
Save bqmackay/97f371e05afd33cde6dcc86fa7ee241d to your computer and use it in GitHub Desktop.
Whitespace Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Bad White Space | |
func request(_ demand: Subscribers.Demand) { | |
assert(demand > 0) | |
guard let downstream = downstream else { return } | |
self.downstream = nil | |
streamHandler { stream in | |
_ = downstream.receive(stream) | |
if case .complete = stream.event { downstream.receive(completion: .finished) } | |
}.resume() | |
} | |
//Good White Space | |
func request(_ demand: Subscribers.Demand) { | |
assert(demand > 0) | |
guard let downstream = downstream else { return } | |
self.downstream = nil | |
streamHandler { stream in | |
_ = downstream.receive(stream) | |
if case .complete = stream.event { | |
downstream.receive(completion: .finished) | |
} | |
}.resume() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment