Created
September 11, 2016 13:02
-
-
Save hajipy/303c77cd593f6eaf1772700c1583d514 to your computer and use it in GitHub Desktop.
ドメインイベントをObservableに変換
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
import Foundation | |
import RxSwift | |
import SwiftEventBus | |
class Query { | |
static func query() -> Observable<String> { | |
return Observable.create { observer in | |
SwiftEventBus.onMainThread(self, name: "SomeDomainEvent") { result in | |
observer.on(.Next("SomeDomainEvent")) | |
} | |
return AnonymousDisposable { | |
SwiftEventBus.unregister("SomeDomainEvent") | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment