SETabView is written is Swift 5 and is deployed for iOS 11.0 and above.
SETabView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'SETabView'
Download and add the files in the Source folder directly into your Xcode Project. In this case you should skip
import SETabView
in the usage instructions.
Import VCTabView
into the View Controller and any child View Controllers
import SETabView
Inherit the SEViewController
class in the parent ViewController
class ViewController: SEViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
}
In viewDidLoad
set the child View Controllers.
class ViewController: SEViewController {
override func viewDidLoad() {
super.viewDidLoad()
// set the child View Controllers
setTabsControllers()
}
private func setViewControllers() {
// instantiate the child View Controllers
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let firstVC = storyboard.instantiateViewController(withIdentifier: "firstVC")
let secondVC = storyboard.instantiateViewController(withIdentifier: "secondVC")
let thirdVC = storyboard.instantiateViewController(withIdentifier: "thirdVC")
let fourthVC = storyboard.instantiateViewController(withIdentifier: "fourthVC")
// assign the child View Controllers
self.viewControllers = [firstVC, secondVC, thirdVC, fourthVC]
}
}
The child View Controllers need to conform to the SETabItem
protocol
class FirstViewController: UIViewController, SETabItem {
var tabImage: UIImage? {
return UIImage(named: "first")
}
override func viewDidLoad() {
super.viewDidLoad()
}
}
Customise the appearance and animation type of the TabBar by overriding the setTabSettings()
and setAnimationType()
functions
override func setTabSettings() {
// customise tab bar appearance
SETabView.settings.tabColor = UIColor.black
SETabView.settings.ballColor = UIColor.black
SETabView.settings.selectedTabTintColor = UIColor.white
SETabView.settings.unselectedTabTintColor = UIColor.gray
// customise animation duration
SETabView.settings.animationDuration = 1.5 // optimal duration = 1.5
}
override func setAnimationType() {
self.animationType = .holeBall3 // defaults to .holeBall3
}
To run the example project, clone the repo, and run pod install
from the Example directory first.
Srivinayak Chaitanya Eshwa, [email protected]
SETabView is available under the MIT license. See the LICENSE file for more info.