I've been using objective-C so far and decided to develop with swift since now.
I have no idea why this simple code doesn't work.
I have two viewControllers as container view from superview, one is called 'sideViewController' and the other one is 'dashViewController'.
I have a segue with identifier 'Appointment' from dashViewController to another viewController called 'nextViewController'
If i try to performsegue in dashViewController.swift, it works fine.
But why it doens't work if i try to use it in 'sideViewController'?
@IBAction public func buttonTapped(_ sender: Any) {
let storyBoard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyBoard.instantiateViewController(withIdentifier: "dashboardViewController")
vc.performSegue(withIdentifier: "Appointment", sender: self) //nothing happens
}
In objective C, I could use singleton for dashViewController like below
[[MainViewController sharedViewController] performSegueWithIdentifier:@"Appointment" sender:nil];
But in swift, following code doesn't work
DashboardViewController.sharedInstance.performSegue(withIdentifier: "Appointment", sender: nil)
I've been struggling with this for 2 days..
Please help me.
Thank you