Situation
An iOS app built in Xamarin with 4 screens. When you start the app it attempts to retrieve information to populate the first screen. If user token expired an exception is thrown. The AppDelegate listens for these messages and when received will show the login screen:
_window.RootViewController.PresentViewController(_loginViewController, true, null);
(_window
is the first screen. _loginViewController
is the screen the user enters their username and password.)
This works OK when on the first screen. But I need a way to show _loginViewController
from ANY screen.
Problem/Questions
- From AppDelegate, is there a way to know what screen is the current screen?
- Is there a different way I should be structuring my project to be able to show the login screen no matter where I am in the app?
- Are there common practices for this scenario?
Note: My project is in Xamarin and supports iOS 8+ but I'm sure if I got a Swift solution I could work with that as well.