Animations
| .holeBall1 | .holeBall2 | .holeBall3 |
|---|---|---|
![]() |
![]() |
![]() |
What's New?
The API has been changed to resemble UITabBarController
- Colors have been renamed to conform to colors specified by
UITabBar - Colors can be set collectively as before (function parameter names have been changed to reflect the changed color names) or individually
- Colors can now be changed at any point in time
- The view controllers at any time
- The animation type can be changed at any time to switch between available animations by setting the
animationTypeproperty! animationDurationcan no longer be changed
Bug fixes
- A bug that caused holeBall3 to behave weirdly in larger screen sizes has been squashed
- Glitchy landscape mode behaviour has been fixed
A whole lot of performance optimizations have been added so that our library does not slow down your app. Hurray!
Requirements
- Swift 5+
- iOS 11.0+
- Swift tools version 5.0+ (For Swift Package Manager)
Integration
CocoaPods
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'
Swift Package Manager
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"))
]Directly include source files
Download and add the files in the Source folder directly into your Xcode Project. In this case you should skip
import SETabViewin the usage instructions.
Usage and Customization
Import SETabView into the parent view controller and any child view controllers
import SETabViewInherit from the SETabViewController class in your tab view controller
class MyCustomTabViewController: SETabViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
}Setting the view controllers and colors
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 the view controllers
setViewControllers(getViewControllers(), initialSelectedTabIndex: 0, animationType: .holeBall3)
}
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")
]
}
}Providing the image for the tab bar
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()
}
}Setting the selected index programmatically
selectedTabIndex = 3Restrictions
- Max 5 Tabs
Example
To run the example project, clone the repo, and run pod install from the Example directory first.
Planned Improvements
- More
UITabBarControllerbehaviours - Increasing support for number of tabs by introducing a More tab
- Badges
- Performance improvements
Author
Srivinayak Chaitanya Eshwa, [email protected]
License
SETabView is available under the MIT license. See the LICENSE file for more info. SETabView uses the complete OrderedCollections code from swift-collections


