A simple and customizable tab bar controller which imitates the Material design. You can customize the position of the tab bar, selection type, content of each tab, colors, fonts, etc. Changes to the tab bar can also be animated with UIKit
.
Import MaterialTabBar at the top of the Swift file of your custom tab bar controller and all child controllers. Subclass the TabBarController
and set child view controllers in viewDidLoad
method.
import MaterialTabBar
class MyTabBarController: TabBarController {
override func viewDidLoad() {
super.viewDidLoad()
let childControllers = [...]
self.setViewControllers(childControllers, animated: false)
}
}
Each child controller needs to implement the TabBarChildController
protocol which makes the tabItem
available. In the tabItem
you can specify the content that is shown in tab for this controller.
import MaterialTabBar
class MyChildViewController: UIViewController, TabBarChildController {
var tabItem: TabBarItem
}
To run the example project, clone the repo, and run pod install
from the Example directory first. In the example project you can see how the MaterialTabBar
can be used.
MaterialTabBar is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'MaterialTabBar'
Michal Rentka, [email protected]
MaterialTabBar is available under the MIT license. See the LICENSE file for more info.