Skip to content

Commit 07de2b8

Browse files
committed
Able to set delegate to UINavigationController
1 parent 35d121a commit 07de2b8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

RxCocoa/iOS/UINavigationController+Rx.swift

+12
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ extension Reactive where Base: UINavigationController {
2020
public var delegate: DelegateProxy<UINavigationController, UINavigationControllerDelegate> {
2121
RxNavigationControllerDelegateProxy.proxy(for: base)
2222
}
23+
24+
/// Installs delegate as forwarding delegate on `delegate`.
25+
/// Delegate won't be retained.
26+
///
27+
/// It enables using normal delegate mechanism with reactive delegate mechanism.
28+
///
29+
/// - parameter delegate: Delegate object.
30+
/// - returns: Disposable object that can be used to unbind the delegate.
31+
public func setDelegate(_ delegate: UINavigationControllerDelegate)
32+
-> Disposable {
33+
return RxNavigationControllerDelegateProxy.installForwardDelegate(delegate, retainDelegate: false, onProxyForObject: self.base)
34+
}
2335

2436
/// Reactive wrapper for delegate method `navigationController(:willShow:animated:)`.
2537
public var willShow: ControlEvent<ShowEvent> {

0 commit comments

Comments
 (0)