I am making a simple fact app (In swift) and all the facts are in separate view controllers and when the user closes the app, it all goes to the main page and you have to start from fact 1 again.
I want to know how to save what view controller the user was on when they closed it and when they continue through the facts again,it starts on that fact. Thanks:) also if someone makes a video i think it will get enough views to start a YT channel
Updated to Swift 5
You can use
UserDefaults
which will remember your lastViewController
.First of all, you have to store some integer when you load any view like shown below:
FirstView.swift
SecondViewController.swift
Now In your AppDelegate.swift read that stored values and load the ViewController related to that Integer this way:
Check out THIS sample project for more Info.