MainTabView
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
iOS 12
Installation
MainTabView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'MainTabView'
Usage
- in the hosting controller add UIView and set its class to MainTabView
- drag outlet of MainTabView
- import MainTabView
- set dataSource to self
code snipts :
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]
}
}
Author
mozead1996, [email protected]
License
MainTabView is available under the MIT license. See the LICENSE file for more info.