Skip to content

Instantly share code, notes, and snippets.

@eunjin3786
Created June 28, 2019 06:01
Show Gist options
  • Save eunjin3786/c383f7e343e7c3e90d4cee137fc1962b to your computer and use it in GitHub Desktop.
Save eunjin3786/c383f7e343e7c3e90d4cee137fc1962b to your computer and use it in GitHub Desktop.
let stream = Publishers.Just("is Alive?")
.delay(for: .seconds(5), scheduler: RunLoop.main)
.sink(receiveCompletion: { (completion) in
switch completion {
case .finished: print("finished")
case .failure(let error): print(error)
}
}, receiveValue: {
print($0)
})
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
UIApplication.shared.keyWindow?.rootViewController = nil
}
<Output>
viewController deinit
is Alive?
finished
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment