Create SWIFT pause menu

0

I am creating an iPhone app using swift 4 and I would like to add a pause menu but I do not know what commands I should use to make everything stop. I have some timers with which I increase the score and create random elements, I had thought I could stop them, is that the best option?

let timer1 = Timer.scheduledTimer(timeInterval: TimeInterval(itemController.randomNumbers(firstNum: 0.5, secondNum: 1)), target: self, selector: #selector (GamePlaySceneClass.spawnItems), userInfo: nil, repeats: true)

timer1.fire()

The objects are affected by gravity, so I suppose it would have to be stopped during the pause. After leaving the pause menu everything should continue as it was

Thank you very much.

    
asked by user5673573 06.05.2018 в 13:39
source

1 answer

0

Your question is not clear to me.

If what you need is to stop the timer you should use:

timer1.invalidate()
    
answered by 07.05.2018 в 12:03