I'm trying to get the 2nd viewcontroller of the tabbarcontroller so i can popToRoot but Swift tells me that using an Int as a subscript is not valid and I have to use an AnyObject as an index
var controller = self.viewControllers[2] as! UIViewController
error is "Cannot subscript a value of type [AnyObject]? with an Int"
var controller = self.viewControllers![2] as! UIViewController
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With