class MoviesViewController5: UIViewController {
static let sharedInstance: MoviesViewController5 = MoviesViewController5()
func fillPage2(menuId menuId:String) {
// ...
}
}
When I try to access fillPage2 like this:
class TabsBarController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let tab4ViewController = UIStoryboard(name: "Main", bundle: Bundle.main).instantiateViewController(identifier: "MoviesViewController5") as! MoviesViewController5
// Add each ViewController to your viewControllers array
// This throws an error
tab4ViewController.sharedInstance.fillPage2(menuId: "2")
// Static member 'sharedInstance' cannot be used on instance of type 'MoviesViewController5'
}
}
This is the error:
Static member 'sharedInstance' cannot be used on instance of type 'MoviesViewController5'
tab4ViewController will actually represent the view. So I need to call the fillPage2 method on it.
Any idea what I'm doing wrong?