Reputation: 59
I am trying to have a countdown timer in a interface controller and when the time is 0 I would like it to perform a segue to the next interface controller.
Is there any way to do this?
if secondsLeft == 0 {
pushController(withName: "RunGameInterfaceController", context: nil)
Upvotes: 0
Views: 47
Reputation: 39
Try using main.storyboard to create a segue between the two controllers.
Then, give the segue an identifier. This can be done on the right bar menu under the "Storyboard and Segue" tab.
In your code, instead of using "pushController"
Use "self.performSegue(withIdentifier: "yourSegueName", sender: self)"
Ensure you replace "yourSegueName" with your identifier, and you should be set to go!
Upvotes: 0