im trying to save and restore last used view controller when the app is opened, however there is the issue that im using a diffrent swift file for each view controller and im not sure how to save it to user defaults.
this is how i switch between controllers
I can save the string objects easily but the last part where it says (withIdentifier: "Sample1") as! SampleFile1, how do i save this SampleFile1 and retrieve it?
this is how i switch between controllers
Code:
let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let newViewController = storyBoard.instantiateViewController(withIdentifier: "Sample1") as! SampleFile1
self.present(newViewController, animated: true, completion: nil)
I can save the string objects easily but the last part where it says (withIdentifier: "Sample1") as! SampleFile1, how do i save this SampleFile1 and retrieve it?