RxFlow icon indicating copy to clipboard operation
RxFlow copied to clipboard

Doesn't work with Peek & Pop gesture

Open av0c0der opened this issue 7 years ago • 10 comments

I did implement the gesture in our app and faced the bug: the app won't continue the navigation process. Reproduced with the demo app. screen shot 2018-10-10 at 15 33 35

av0c0der avatar Oct 10 '18 13:10 av0c0der

Hi @Jauzee

Can you provide a full example please ?

twittemb avatar Oct 14 '18 03:10 twittemb

Hi @twittemb. Sorry for the late response, I missed your message.

I forked the repo and changed the WishlistViewController.swift file here: https://github.com/Jauzee/RxFlow/tree/develop

av0c0der avatar Oct 16 '18 14:10 av0c0der

Thanks for your repo @Jauzee

In the current version, RxFlow is not suited for peek n pop usage.

In the RxFlow philosophy the ViewControllers are created by the Flows. Peek n pop needs to implement the creation of the destination ViewController in its delegate (aka the WishlistViewController) ... unfortunately it is not compatible with the current implementation of RxFlow.

I can't see a good way to do this because the aim of the Coordinator pattern is to hide the ViewControllers creation from the previous ViewControllers.

Do you have a good idea on this ?

twittemb avatar Oct 16 '18 23:10 twittemb

@twittemb no, I didn't investigate it yet.

In our app I only create a view controller for the preview. So in the delegate callback I only call some method, which triggers new step in a Flow. I can't understand why the Flow doesn't receive further steps. It opens the view controller which was previewed, but then the navigation stops.

av0c0der avatar Oct 17 '18 23:10 av0c0der

Hi @Jauzee

You can consider RxFlow, and all the coordinator pattern based frameworks as replacement for the segue based navigation.

Peek and pop requires a navigation in 2 phases (VC creation and VC commit). It is a very special way of navigating.

twittemb avatar Oct 22 '18 02:10 twittemb

Hi @twittemb. I understand that, but you can commit any view controller, you're not limited to present the view controller that was created for a preview. You can just throw it out and call your new Step, so I believe there's a way to handle this. Can you please explain a little why it doesn't handle new Steps, what's the key difference here?

av0c0der avatar Oct 22 '18 23:10 av0c0der

Hi @twittemb!

Commenting this line resolves the problem. Why it can be a problem in this case?

av0c0der avatar Oct 23 '18 17:10 av0c0der

@Jauzee Hi! I registered another issue, which I traced to the same line in Coordinators.swift but with different observed effect (missing section titles in some tables). As it turned out my problem was I didn't clear the existing delegate/datasource for tables (debug version of RxSwift has the asserts for this, but I was using release version). So the behavior is definitely related to rxVisible/displayed implementation and the way RxCocoa implements delegate interceptors. Just my $.02

ssaluk avatar Nov 02 '18 06:11 ssaluk

Thank you very much for your feedback @ssaluk. It can be helpful.

av0c0der avatar Nov 03 '18 05:11 av0c0der

You can actually emit steps, but after some delay. I just tried

    func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit viewControllerToCommit: UIViewController) {
        Observable<Void>.just(())
            .delay(0.5, scheduler: MainScheduler.asyncInstance)
            .map { _ in AppStep.transactionDetail }
            .bind(to: viewModel.step)
            .disposed(by: disposeBag)
    }

and and didn't stop navigation process.

dsk1306 avatar Nov 13 '18 11:11 dsk1306

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 Jun 06 '23 11:06 github-actions[bot]

This issue has automatically been closed due to inactivity.

github-actions[bot] avatar Jun 22 '23 00:06 github-actions[bot]