I want to determine if first VC of TabBarController is a SearchVC and if it is, load the second VC on launch. I've created subclass of TabBarController and in viewDidLoad() method I tried the following:
if let first = self.viewControllers?[0] as? SearchVC{
self.selectedIndex = 1
}else{
self.selectedIndex = 0
}
And
if self.viewControllers?[0] is SearchVC{
self.selectedIndex = 1
}else{
self.selectedIndex = 0
}
The first controller is SearchVC and it returns 0 when it should be 1
EDIT: Also if self.viewControllers?[0].isKind(of: SearchVC())
doesn't work