Created
March 25, 2016 22:23
-
-
Save edwardIshaq/7ada399d8784416176d5 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
// | |
// Rac4VC.swift | |
// Pop | |
// | |
// Created by Edward Ishaq on 3/25/16. | |
// Copyright © 2016 Zuno. All rights reserved. | |
// | |
import UIKit | |
import Result | |
import ReactiveCocoa | |
class Rac4VC: UIViewController { | |
@IBOutlet weak var button: UIButton! | |
func demoAction() -> Action<AnyObject?, String, NoError> { | |
return Action{ input in | |
return SignalProducer<String, NoError>{ sink, dispose in | |
sink.sendNext("Success") | |
sink.sendCompleted() | |
} | |
} | |
} | |
@IBAction func buttonAction(sender: UIButton) { | |
demoAction() | |
.apply(sender) | |
.on { (next: String) in | |
print(next) | |
} | |
.onError{ (actionError: ActionError<NoError>) in | |
print(actionError) | |
} | |
.start() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment