Reputation: 2251
In my AppDelegate's applicationWillEnterForeground(_:)
method, I am starting a specific ViewController that requires the user to perform local authentication via biometrics or passcode. After that, I want to return to the ViewController the user was in when they left the app, but I don't know how I can get that information.
Right now I am just sending them back to the start screen of the app every time, but it would be nice to be able to return to where they left off when the app was paused. How would I accomplish this?
Upvotes: 0
Views: 81
Reputation: 125017
After that, I want to return to the ViewController the user was in when they left the app, but I don't know how I can get that information.
One option is to save the information you need to put the app back in the state that the user expects when it becomes active again.
Another option is to take advantage of the app state restoration process to put your app back in the expected state.
Either way, the process will be the inverse of what you describe: you'll restore the app first, and then present the authentication view controller to make the user log in again before continuing.
Upvotes: 1
Reputation: 1411
Have you tried to show your ViewController as a popup and then just dismiss?
Actually your question is too general. Please provide some code how do you show this view controller. Because accessing previous controller may not be the same in different cases.
As an example.
Upvotes: 0