.holeBall1 | .holeBall2 | .holeBall3 |
---|---|---|
UITabBarController
UITabBar
animationType
property!animationDuration
can no longer be changedA whole lot of performance optimizations have been added so that our library does not slow down your app. Hurray!
SETabView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'SETabView'
In case the latest version (2.0.0) is not the one being installed, update the pod.
pod update 'SETabView'
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler.
Once you have your Swift package set up, adding SETabView as a dependency is as easy as adding it to the dependencies
value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/eshwavin/SETabView.git", .upToNextMajor(from: "2.0.0"))
]
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 SETabView
into the parent view controller and any child view controllers
import SETabView
Inherit from the SETabViewController
class in your tab view controller
class MyCustomTabViewController: SETabViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
}
Set the view controllers using setViewControllers(_:)
method or by directly setting the viewControllers
property
Customise the look by calling setTabColors(backgroundColor:ballColor:tintColor:unselectedItemTintColor:barTintColor:)
method or simply setting the respective colors
class ViewController: SEViewController {
override func viewDidLoad() {
super.viewDidLoad()
// set tab bar look collectively
setTabColors(backgroundColor: UIColor.white, ballColor: UIColor.white, tintColor: UIColor.black, unselectedItemTintColor: UIColor.red, barTintColor: .clear)
// set animation type
animationType = .holeball3
// set the view controllers
setViewControllers(getViewControllers())
}
private func getViewControllers() -> [UIViewController] {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
return [
storyboard.instantiateViewController(withIdentifier: "firstVC"),
storyboard.instantiateViewController(withIdentifier: "secondVC"),
storyboard.instantiateViewController(withIdentifier: "thirdVC"),
storyboard.instantiateViewController(withIdentifier: "fourthVC"),
storyboard.instantiateViewController(withIdentifier: "fifthVC")
]
}
}
The child view controllers can conform to the SETabItemProvider
protocol. Using seTabImage
return a UITabBarItem
for the view controller.
Alternatively you can set the tabBarItem
property for the view controllers as you would do when using UITabBarController
class FirstViewController: UIViewController, SETabItemProvider {
var seTabBarItem: UITabBarItem? {
return UITabBarItem(title: "", image: UIImage(named: "first"), tag: 0)
}
override func viewDidLoad() {
super.viewDidLoad()
}
}
selectedTabIndex = 3
To run the example project, clone the repo, and run pod install
from the Example directory first.
UITabBarController
behavioursSrivinayak Chaitanya Eshwa, eshwavin@gmail.com
SETabView is available under the MIT license. See the LICENSE file for more info. SETabView uses the complete OrderedCollections code from swift-collections