- UIKit
- SwiftUI (Thanks to Alpay Calalli)
RevolvTabBar is a customizable and easy-to-use tab bar controller for iOS applications. It allows you to quickly set up a tab bar with multiple view controllers, providing a seamless navigation experience.
To integrate RevolvTabBar into your Xcode project using Swift Package Manager, add it to your Package.swift:
dependencies: [
.package(url: "https://github.com/aykhanhajiyev/RevolvTabBar.git", from: "1.0.8")
]Then, add RevolvTabBar as a dependency to your target:
.target(
name: "YourTargetName",
dependencies: ["RevolvTabBar"]
)Here's an example of how to set up RevolvTabBar in your project:
import UIKit
import RevolvTabBar
class ViewController: RevolvTabBar {
private let homeVC: UIViewController = {
let vc = UIViewController()
vc.view.backgroundColor = .white
return vc
}()
private let secondVC: UIViewController = {
let vc = UIViewController()
vc.view.backgroundColor = .yellow
return vc
}()
private let thirdVC: UIViewController = {
let vc = UIViewController()
vc.view.backgroundColor = .systemPink
return vc
}()
override var items: RevolvTabBarView.Item {
.defaultStyle
}
override var viewControllers: [UIViewController] {
[homeVC, secondVC, thirdVC]
}
override func viewDidLoad() {
super.viewDidLoad()
}
}- Importing RevolvTabBar:
import RevolvTabBarEnsure you import the RevolvTabBar package at the beginning of your file.
- Creating View Controllers:
private let homeVC: UIViewController = {
let vc = UIViewController()
vc.view.backgroundColor = .white
return vc
}()
private let secondVC: UIViewController = {
let vc = UIViewController()
vc.view.backgroundColor = .yellow
return vc
}()
private let thirdVC: UIViewController = {
let vc = UIViewController()
vc.view.backgroundColor = .systemPink
return vc
}()Here, we create three view controllers (homeVC, secondVC, thirdVC) with different background colors which they are our tabBar controllers.
- Setting Tab Bar Items:
override var items: RevolvTabBarView.Item {
.defaultStyle
}This property defines the style of the tab bar items. You can customize it according to your needs.
- Assigning View Controllers:
override var viewControllers: [UIViewController] {
[homeVC, secondVC, thirdVC]
}This property returns an array of view controllers to be displayed in the tab bar.
- viewDidLoad:
override func viewDidLoad() {
super.viewDidLoad()
}Ensure you call super.viewDidLoad() in your viewDidLoad method to properly initialize the tab bar.
- tabBarBackgroundColor:
override var tabBarBackgroundColor: UIColor? {
.red
}It changes background color of tabBar view.
RevolvTabBar is available under the MIT license. See the LICENSE file for more information
