Created
January 27, 2016 14:50
-
-
Save Eluss/81de173bf0d6987656e9 to your computer and use it in GitHub Desktop.
This file contains 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
// creating a signal | |
let (signal, sink) = Signal<Int, NoError>.pipe() | |
// function called when button is tapped | |
func buttonTapped(sender: UIButton) { | |
// sending random value down the stream | |
sendNext(sink, random() % 3) | |
} | |
// somewhere in the application | |
signal.observeNext {(value) -> () in | |
// print received value | |
print(value) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment