RxFlow icon indicating copy to clipboard operation
RxFlow copied to clipboard

Child view controller steps

Open wintermoon9 opened this issue 5 years ago • 2 comments

Hi,

I have a custom view controller that lets the user switch between different view controllers. When a VC is selected, it's embedded in a container view.

    func presentContent(vc: UIViewController) {
        if let currentVc = self.currentVc {
            currentVc.view.removeFromSuperview()
            currentVc.removeFromParent()
        }
        
        vc.willMove(toParent: self)
        vc.view.frame = CGRect(x: 0, y: 0, width: container.frame.width, height: container.frame.height)
        container.addSubview(vc.view)
        addChild(vc)
        vc.didMove(toParent: self)
        
        currentVc = vc
    }

My Flow then does this...

    func navigateToMain() -> FlowContributors {
        let flowA = FlowA()
        let flowB = FlowB()
        let flowC = FlowC()
        let flowD = FlowD()

        mainVc = MainViewController.create()
        
        Flows.whenReady(flow1: flowA, flow2:  flowB, flow3: flowC, flow4: flowD) { [weak self] a, b, c, d in
            guard let `self` = self else {
                return
            }
            
            self.flowA = flowA
            self.flowB = flowB
            self.flowC = flowC
            self.flowD = flowD
            
            if let mainVc = self.mainVc {
                self.rootViewController.pushViewController(mainVc, animated: true)
            }
            
        }
        
        return .multiple(flowContributors: [
            .contribute(withNext: mainVc!),
            .contribute(withNextPresentable: flowA, withNextStepper: OneStepper(withSingleStep: AppStep.stepA), allowStepWhenNotPresented: false),
            .contribute(withNextPresentable: flowB, withNextStepper: OneStepper(withSingleStep: AppStep.stepB), allowStepWhenNotPresented: false),
            .contribute(withNextPresentable: flowC, withNextStepper: OneStepper(withSingleStep: AppStep.stepC), allowStepWhenNotPresented: false),
            .contribute(withNextPresentable: flowD, withNextStepper: OneStepper(withSingleStep: AppStep.stepD), allowStepWhenNotPresented: false)
        ])

When I first open the main VC, flow A will be presented. I can interact with the view and will receive steps in FlowA. If I switch to Flow B, the container removes Flow A's root and then adds Flow B's root. When I navigate back to Flow A, it simply removes Flow B's root then adds Flow A's root as an embedded child view controller. At that point I no longer receive step events from Flow A.

Yes, I have basically had to implement my own tab bar controller for some internal reasons. I was able to get a UITabBarController working but I need to use my own embedded controller system for navigation so I would appreciate any help. What am I missing?

Thank you so much :)

wintermoon9 avatar Jun 02 '20 18:06 wintermoon9

Any updates on that one?

pierre-wehbe avatar Dec 21 '20 21:12 pierre-wehbe

Is this issue resolved?

erginbilgin avatar Aug 04 '21 09:08 erginbilgin

If this is still an issue with the latest release, could you create a sample project please?

mgray88 avatar Jun 17 '23 20:06 mgray88

This issue has not received any recent updates. We encourage you to check if this is still an issue after the latest release and if you find that this is still a problem, please leave a comment below and auto-close will be canceled.

github-actions[bot] avatar Aug 17 '23 00:08 github-actions[bot]

This issue has automatically been closed due to inactivity.

github-actions[bot] avatar Aug 31 '23 00:08 github-actions[bot]