diff --git a/RxCocoa/iOS/UINavigationController+Rx.swift b/RxCocoa/iOS/UINavigationController+Rx.swift index d223bee9c..e3ae9d267 100644 --- a/RxCocoa/iOS/UINavigationController+Rx.swift +++ b/RxCocoa/iOS/UINavigationController+Rx.swift @@ -20,6 +20,18 @@ extension Reactive where Base: UINavigationController { public var delegate: DelegateProxy { RxNavigationControllerDelegateProxy.proxy(for: base) } + + /// Installs delegate as forwarding delegate on `delegate`. + /// Delegate won't be retained. + /// + /// It enables using normal delegate mechanism with reactive delegate mechanism. + /// + /// - parameter delegate: Delegate object. + /// - returns: Disposable object that can be used to unbind the delegate. + public func setDelegate(_ delegate: UINavigationControllerDelegate) + -> Disposable { + return RxNavigationControllerDelegateProxy.installForwardDelegate(delegate, retainDelegate: false, onProxyForObject: self.base) + } /// Reactive wrapper for delegate method `navigationController(:willShow:animated:)`. public var willShow: ControlEvent {