I am making a game with a lot of levels. Each level is a scene. I want to save the current scene(level) that the user is on. so when they open the game they don't have to restart from level one. I have a mainMenu scene and when the user goes to play I want the game to pick up where the user left off at. I have been doing so much research, and everything I find doesn't apply to my situation or its poorly explained. Can someone please help me with this?
I use this code to transition from scene to scene
levelthree = levelThree(fileNamed: "levelThree")
levelthree?.scaleMode = .aspectFill
self.view?.presentScene(levelthree!, transition: SKTransition.fade(withDuration: 0.1))
but when i exit the game it goes back to the first scene. how can i make it so that it saves the progress in the game and does not go back to level 1?