Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced navigation #73

Closed
pgawlowski opened this issue Jun 3, 2018 · 1 comment
Closed

Advanced navigation #73

pgawlowski opened this issue Jun 3, 2018 · 1 comment
Labels

Comments

@pgawlowski
Copy link

pgawlowski commented Jun 3, 2018

@ferranabello
Any hints on advanced navigation?

Routing examples:

let's start LoggedOutModule without navigation bar
we've got 2 paths:

  • register - with navigationBar
  • login - with navigationBar

Register process got 3 steps:

  • registerFormModule - with navigationBar
  • terms&conditionsModule - with navigationBar
  • registerSuccessModule - without navigation bar

After register process we should unwind/jump back/show LoggedOutModule once again (without navigationBar).

How to handle whole navigation bar embedding/showing/hiding process + backrouting to previous modules (without navigation bars e.x).

My current idea is for showing-hiding of navigation controller is

    override func viewIsAboutToAppear() {
        super.viewIsAboutToAppear()
        _view.navigationController?.setNavigationBarHidden(true, animated: false)
    }

And for routback to view is to just dismiss view which is currently presented over LoggedOutView

// MARK: - RegisterSuccessRouter API
extension RegisterSuccessRouter: RegisterSuccessRouterApi {
    func routeToLoggedOutModule() {
        _view.dismiss(animated: true, completion: nil)
    }
}

Is this correct approach?

@ferranabello
Copy link
Owner

Hi @pgawlowski ,
this looks like view presentation logic, not much to do with routing itself.

Showing or hiding certain things in the view should be done by the presenter or the view itself.

If this is a problem that you need to solve through the entire application, I suggest you to create some BaseView class with properties like "shouldShowNavigationBar", "shouldShowTabBar", etc. They could have a default "true" value and you could override them wherever you need them.

Then your "BaseView" could check these values in the viewWillAppear, viewWillDisappear and do as told.

That's a possible solution :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants