Last active
June 5, 2019 05:43
-
-
Save hermanbanken/91b45737a58dc0663b8a91d5c2fd0024 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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) | |
| }) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment