Last active
November 29, 2016 04:36
-
-
Save czars/20834dd3df18225ea52f7e8ade7c73e2 to your computer and use it in GitHub Desktop.
ReactiveCocoa then and concat
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
private class func testSignalOne() -> RACSignal { | |
return RACSignal.createSignal { (subscriber) -> RACDisposable! in | |
print("test for true") | |
subscriber.sendNext(true) | |
subscriber.sendCompleted() | |
return RACDisposable { | |
// task.cancel() | |
} | |
} | |
} | |
private class func testSignalTwo() -> RACSignal { | |
return RACSignal.createSignal { (subscriber) -> RACDisposable! in | |
print("test signal two") | |
subscriber.sendNext(nil) | |
subscriber.sendCompleted() | |
return RACDisposable { | |
// task.cancel() | |
} | |
} | |
} | |
private class func testSignalThree() -> RACSignal { | |
return RACSignal.createSignal { (subscriber) -> RACDisposable! in | |
print("test signal three") | |
subscriber.sendNext(nil) | |
subscriber.sendCompleted() | |
return RACDisposable { | |
// task.cancel() | |
} | |
} | |
} | |
class func purchase(product: SKProduct) -> RACSignal { | |
return RACSignal.`if`(self.testSignalOne(), then:RACSignal.empty(), else: self.testSignalTwo()) | |
.then{ _ in | |
return self.testSignalThree() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment