Closed akhilcb closed 6 years ago
@akhilcb Hi, at the moment there is no such property, I recommended that you keep an array that holds your controllers. However if you want a quick solution you can use this code:
Include this extension in the AZTabBarController.swift
:
public extension AZTabBarController {
public var currentTab: UIViewController? {
if selectedIndex >= 0,selectedIndex < tabCount, let controller = controllers[selectedIndex] { return controller }
return nil
}
}
You can then call it like so:
let controller: UIViewController? = tabBar.currentTab
Thanks. This what I ended up doing. It would be really helpful for others too if you could add this as a property of AZTabBarController itself in next release. Especially when someone is switching from UITabBarController to AZTabBarController, this will help.
@akhilcb Alright, I will include this in the next release. Thank you for your feedback.
Thanks for the great library. I am using this library through cocoapods and I have a query. I am trying to get
selectedViewController
fromAZTabBarController
similar to the same property inUITabBarController
, but I am not able to locate it. Please let me know how I can get that. If possible please add the same to the library itself so that it would be useful to more people.