This might be a little confusing, but I am trying to keep my iOS app on a certain view until the user exits out of it. Problem is that view isn't the initial VC, so when it clears from RAM all data entered is lost. Is there a way to maintain that view in memory for the as long as I'd like? I've considered using CoreData, but that would only save that data, and I want to maintain the session that certain view.
Asked
Active
Viewed 440 times
-1
-
1You might want to look into state restoration. Plenty of docs and tutorials online. – Kevin Renskers Mar 05 '20 at 23:36
-
this is exactly what I was looking for, thank you – ShedSports Mar 05 '20 at 23:52
-
unfortunately nothing I found has worked – ShedSports Mar 06 '20 at 01:57
1 Answers
0
You can't store the VC, but you can store where you want to go (e.g. with UserDefaults
) and use AppDelegate/SceneDelegate to present the VC programatically (it doesn't matter if it is set as initial VC in the storyboard or not). To do this, follow the steps you can find e.g. here (AppDelegate) or here (SceneDelegate)

Michael
- 657
- 5
- 22
-
This is now outdated if you are using iOS13.x as you will now need to present the initial VC from SceneDelegate. – flanker Mar 05 '20 at 23:52