In my app I've got moment where I use timer to go from one view controller to next view controller, and it doesn't work. Could somebody tell me what's wrong?
class fifthViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let delay : Double = 2.0 // 2 seconds here
DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let IDKViewController = storyBoard.instantiateViewController(withIdentifier: "IDKview") as! IDKViewController
self.present(IDKViewController, animated:true, completion:nil)
}
}
}
it doesn't work
That does not provide any useful information.
- What do you get
- Do you get error message?
- Do you get a crash ?
- what do you expect ?
- Is it SwiftUI ? If so, show complete code
I tested in a project, it works as expected.
Are you sure you defined IDKview
class in IB correctly ?
And please, answer the post here, not in a new one, and close previous posts if they are terminated.