mvvm light and navigation

Michael_ShapiroMichael_Shapiro USMember ✭✭✭

Hello everyone,

Very common scenario: SignInScreen >>(if_successful)>> OtherScreens.

But I use MVVM Light for binding and navigation in my view models. As a result I do not have all the fine tune control of segues and transitions between screens. The first, and the main, problem is - how do I prevent users from going BACK to SIgnIn screen after they have moved on to the other screens in the app? I've seen many patterns but none that deals with the MVVM Light and iOS. Some suggestions are to use two independent storyboards -one for login logic and another for the rest of the app. Other suggestions are to switch the rootview controller upon successful login. But I do not see how any of it can really work with the MVVMLight navigation approach because all the navigation is done (is supposed to be done) in the ViewModel of my PCL layer and outside of the iOS view controller.

My (desired) structure is

    SignIn >>
        MainScreen >>
                TabView >> 
                    >Tab1
                    >Tab2
                    >Tab3
                TabView >> 
                    >Tab1
                    >Tab2

By performing navigation in ViewModel layer with MVVM Light navigator, after logging in and transitioning to MainScreen I see the Back button which allows you to simply go back to SignIn screen. But users definitely should not be allowed to simply go back to login screen... unless they explicitly are signing out.

I found one way to "fix" this problem. In the MainScreen on ViewDidLoad I simply hide the Back button with NavigationController.SetNavigationBarHidden(true, true); It sounds so simple and primitive that I am afraid it is not the right approach:)

Please, if you have build apps with MVVM Light - what is the best way of handling this situation?

Thank you,
mike

Answers

  • Michael_ShapiroMichael_Shapiro USMember ✭✭✭

    Have I made a mistake by using mvvm light at all? Reaching out anyone with the mvvm light experience have been an impossible task for both projects I have (ios and android) :( Does anyone know of any forum that is mvvm light specific by any chance, please?

    Thank you,
    mike

Sign In or Register to comment.