Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct MyPublisher : Publisher {
- public typealias Failure = Error
- public typealias Output = Int
- @available(iOS 13.0, *)
- public func receive<S>(subscriber: S) where S : Subscriber, Failure == S.Failure, Output == S.Input {
- DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(2), execute: {
- _ = subscriber.receive(42)
- subscriber.receive(completion: .finished)
- })
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement