Created
February 25, 2020 08:04
-
-
Save illescasDaniel/7c09e63a854dcbf2d2f9a68b87777d75 to your computer and use it in GitHub Desktop.
Stream example swift
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
| class Stream<T> { | |
| var handler: ((T) -> Void)? | |
| func emitValue(_ value: T) { | |
| handler?(value) | |
| } | |
| func listen(_ handler: @escaping (T) -> Void) { | |
| self.handler = handler | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment