Skip to content

Commit

Permalink
Able to set delegate to UINavigationController
Browse files Browse the repository at this point in the history
  • Loading branch information
mlch911 committed Sep 10, 2024
1 parent 35d121a commit 07de2b8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions RxCocoa/iOS/UINavigationController+Rx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ extension Reactive where Base: UINavigationController {
public var delegate: DelegateProxy<UINavigationController, UINavigationControllerDelegate> {
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<ShowEvent> {
Expand Down

0 comments on commit 07de2b8

Please sign in to comment.