Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. struct MyPublisher : Publisher {
  2. public typealias Failure = Error
  3. public typealias Output = Int
  4.  
  5. @available(iOS 13.0, *)
  6. public func receive<S>(subscriber: S) where S : Subscriber, Failure == S.Failure, Output == S.Input {
  7. DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(2), execute: {
  8. _ = subscriber.receive(42)
  9. subscriber.receive(completion: .finished)
  10. })
  11. }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement