Skip to content

Instantly share code, notes, and snippets.

@iamchiwon
Last active June 11, 2018 14:49
Show Gist options
  • Save iamchiwon/dbce660cb86bfe5027c1ce5ef5300a5e to your computer and use it in GitHub Desktop.
Save iamchiwon/dbce660cb86bfe5027c1ce5ef5300a5e to your computer and use it in GitHub Desktop.
Rx Wrapping 예제 (methodInvoked)
import RxSwift
import RxCocoa
extension Reactive where Base: UIViewController {
var viewWillAppear: ControlEvent<Void> {
let source = methodInvoked(#selector(Base.viewWillAppear)).map { _ in }
return ControlEvent(events: source)
}
var viewDidAppear: ControlEvent<Void> {
let source = methodInvoked(#selector(Base.viewDidAppear)).map { _ in }
return ControlEvent(events: source)
}
var viewWillDisappear: ControlEvent<Void> {
let source = methodInvoked(#selector(Base.viewWillDisappear)).map { _ in }
return ControlEvent(events: source)
}
var viewDidDisappear: ControlEvent<Void> {
let source = methodInvoked(#selector(Base.viewDidDisappear)).map { _ in }
return ControlEvent(events: source)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment