Skip to content

Navigation Controller Delegate not workingΒ #255

@phuongddx

Description

@phuongddx
    case root
}

final class CommunitiesCoordinator: NavigationCoordinator<CommunitiesRoute> {
    init() {
        super.init(initialRoute: .root)
        delegate = RootNavigationControllerDelegateWrapper()
    }

    override func prepareTransition(for route: CommunitiesRoute) -> NavigationTransition {
        switch route {
            case .root:
                let rootVc = CommunitiesViewController()
                return .push(rootVc)
        }
    }
}

final class RootNavigationControllerDelegateWrapper: NSObject,
                                                     UINavigationControllerDelegate {
    func navigationController(_ navigationController: UINavigationController,
                              willShow viewController: UIViewController,
                              animated: Bool) {
        print("πŸš€ Will show: \(type(of: viewController))")
    }
    
    func navigationController(_ navigationController: UINavigationController,
                              didShow viewController: UIViewController,
                              animated: Bool) {
        print("βœ… Did show: \(type(of: viewController))")
    }
}

I have simple routing like that, but look like delegate func not to be call, could you guys help me check on it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions