Reputation: 9
I want to show the user a title screen of the app name firstly and then, after about 2 seconds, the view should proceed to a new view controller.
So far, I have a segue with an identifier. I see a lot of tutorials use IBAction
s/IBOutlet
s but I'm not sure if I would use one here since there's no single item that would trigger the segue aside from the timeout.
Upvotes: 0
Views: 211
Reputation: 58129
Just use DispatchQueue.main.asyncAfter(deadline:)
in viewDidLoad
. This code triggers the segue with the given identifier after a 2 seconds delay:
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
self.performSegue(withIdentifier: "your segue's identifier", sender: self)
}
Upvotes: 4