To run the example project, clone the repo, and run pod install
from the Example directory first.
iOS 12
MainTabView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'MainTabView'
- in the hosting controller add UIView and set its class to MainTabView
- drag outlet of MainTabView
- import MainTabView
- set dataSource to self
import MainTabView
@IBOutlet weak var mainTabView: MainTabView?
class ViewController : UIViewController{
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
mainTabView?.dataSource = self
}
}
//here we give it our viewControllers to show
extension ViewController : MainTabViewDataSource{
// each child UIViewController should conform to TabItem
func viewControllersToBeHosted(in mainTabView: MainTabView) -> [TabItem] {
let firstVC = instance(FirstViewController.self)//FirstViewController.instance()
let secondVC = instance(SecondViewController.self)
let thirdVC = instance(ThirdViewController.self)
return [firstVC,secondVC,thirdVC]
}
}
mozead1996, mohamedzead2021@gmail.com
MainTabView is available under the MIT license. See the LICENSE file for more info.