A lightweight customized tabbar view. πŸ“Œ

Overview

HHTabBarView

A lightweight customized tabbar view.

License Platform Swift 4.x MadeWithLove Awesome-Swift

  1. Screenshots
  2. Features
  3. Installation
  4. Setup
  5. ToDos
  6. Credits
  7. Thanks
  8. License

Screenshots

Only Icon Icon (top) with title (bottom) Only Title
Icon (left) with title (right) Icon (right) with title (left) Icon (bottom) with title (top)
HHTabBarView top position HHTabBarView top position (iPhoneX)
Usage

Features

  1. Easily Configurable and Setup. Create tabs with Title, or Image or both.
  2. Dynamic Tabs Configurations.
  3. Detect Taps in a completion block.
  4. Show/Hide Badge Value in individual tabs. Easily Configure as per the needs.
  5. Lock/Unlock particular tabs.
  6. Easily show/hide UINavigationBar and HHTabBarView.
  7. Lightweight with zero dependancies.
  8. Change UI of HHTabBarView (LeftToRight or RightToLeft) as per the needs.
  9. Change HHTabBarView position as per UI requirements. Supports: Top and Bottom (Default).
Note: I don't recommended displaying HHTabBarView at the top. It's always good at the bottom.

Installation

  1. Manually – Add HHTabBarView/Source folder to your Project. And you're good to use HHTabBarView.

  2. CocoaPods: – pod 'HHTabBarView'

You can read the CHANGELOG file for a particular release.

Setup

Important: Please note that HHTabBarView is currently not supports UIStoryBoard. Means, you will have to create HHTabBarView programmatically. It is advised to setup HHTabBarView in AppDelegate.swift for your easyness.

  1. Initialize and keeping reference of HHTabBarView. πŸ“Œ
    let hhTabBarView = HHTabBarView.shared
  1. Keeping reference of iOS default UITabBarController. πŸ“Œ
    let referenceTabBarController = HHTabBarView.shared.referenceUITabBarController
  1. Setup referenced UITabBarController πŸ“Œ
    func setupReferenceUITabBarController() -> Void {
        
        //Creating a storyboard reference
        let storyboard = UIStoryboard.init(name: "Main", bundle: Bundle.main)
        
        //Creating navigation controller for navigation inside the first tab.
        let navigationController1: UINavigationController = UINavigationController.init(rootViewController: storyboard.instantiateViewController(withIdentifier: "FirstViewControllerID"))
        
        //Creating navigation controller for navigation inside the second tab.
        let navigationController2: UINavigationController = UINavigationController.init(rootViewController: storyboard.instantiateViewController(withIdentifier: "SecondViewControllerID"))
        
        //Update referenced TabbarController with your viewcontrollers
        referenceTabBarController.setViewControllers([navigationController1, navigationController2], animated: false)
    }
  1. Setup HHTabBarView πŸ“Œ
    //Update HHTabBarView reference with the tabs requires.
    func setupHHTabBarView() -> Void {
        
        //Default & Selected Background Color
        let defaultTabColor = UIColor.white
        let selectedTabColor = UIColor.init(red: 234/255, green: 218/255, blue: 195/255, alpha: 1.0)
        let tabFont = UIFont.init(name: "Helvetica-Light", size: 14.0)
        
        //Create Custom Tabs
        let t1 = HHTabButton.init(withTitle: "Calendar", tabImage: UIImage.init(named: "Calendar")!, index: 0)
        t1.titleLabel?.font = tabFont
        t1.titleLabel?.textColor = UIColor.black
        t1.setHHTabBackgroundColor(color: defaultTabColor, forState: .normal)
        t1.setHHTabBackgroundColor(color: selectedTabColor, forState: .selected)
        
        let t2 = HHTabButton.init(withTitle: "Refresh", tabImage: UIImage.init(named: "Refresh")!, index: 1)
        t2.titleLabel?.font = tabFont
        t2.titleLabel?.textColor = UIColor.black
        t2.setHHTabBackgroundColor(color: defaultTabColor, forState: .normal)
        t2.setHHTabBackgroundColor(color: selectedTabColor, forState: .selected)
        
        //Note: As HHTabButton are subclassed of UIButton so you can modify it as much as possible.
        
        //Set Custom Tabs
        hhTabBarView.tabBarTabs = [t1, t2]
        
        //Set Default Index for HHTabBarView.
        hhTabBarView.defaultIndex = 1
        
        //Show Animation on Switching Tabs
        hhTabBarView.tabChangeAnimationType = .none
        
        //Handle Tab Change Event
        hhTabBarView.onTabTapped = { (tabIndex) in
            print("Selected Tab Index:\(tabIndex)")
        }
    }
  1. Setup window of your application inside the πŸ“Œ
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        
        //Setup HHTabBarView
        setupReferenceUITabBarController()
        setupHHTabBarView()
        
        //Setup Application Window
        self.window = UIWindow.init(frame: UIScreen.main.bounds)
        self.window?.rootViewController = self.referenceTabBarController
        self.window?.makeKeyAndVisible()
        
        return true
    }
  1. Done! βœ…

ToDo[s]

  • Update README with multiple example usage and screenshots.

You can watch to HHTabBarView to see continuous updates. Stay tuned.

Have an idea for improvements of this class? Please open an issue.    

Credits

Hemang Shah

You can shoot me an email to contact.  

Thank You!!

See the contributions for details.

License

The MIT License (MIT)

Read the LICENSE file for details.

Comments
  • Logo proposal

    Logo proposal

    Good day Sir @hemangshah ,

    I am a graphics designer and i want to contribute on your project by designing a logo for it as a gift for free if you will permit me. I have noticed you don't have logo yet. Ill wait for your approval first before I start.

    Thanks and best regards! -Tobaloidee

    enhancement 
    opened by Tobaloidee 17
  • Custom Title Color and Insets for Tab Bar Button

    Custom Title Color and Insets for Tab Bar Button

    The customizable titleLabel color has been fixed. (You can set the titleLabel color on the initilization step now.)

    • We can adjust the button titleLabel color in initialization.
    • When the button and the image are set together, the squeezed view between them is resolved.
    enhancement 
    opened by batuhansk 4
  • More than 5 Tabs won't work.

    More than 5 Tabs won't work.

    Here i added 6 tab, but only 5 tabs are works and other tab's tab-button appears but doesn't work. Someone had solution for this please help., Thanks in advance

    question 
    opened by steveGates890 1
  • Correct syntax for cd HHTabBarView/ command

    Correct syntax for cd HHTabBarView/ command

    Hi @hemangshah,

    This is Luna from Travis CI again. I have corrected the syntax error in your config. This cds into the HHTabBarView folder where your xcode project is located so the xcodebuild command can find the project.

    An email will accompany this pull request

    opened by ghost 1
  • Fix .travis.yml config

    Fix .travis.yml config

    Hi @hemangshah!

    This is Luna from Travis CI. This should result in a green build. It is just building the project and doing so without code signing.

    This pull request will accompany an email as well. Please follow-up with any questions you may have over there.

    opened by ghost 1
  • Go back in navigation hierarchy when tapping on the same tab again.

    Go back in navigation hierarchy when tapping on the same tab again.

    Tab 1 β†  Navigation Controller ↦ View Controller 1 β†’ View Controller 2 β†’ View Controller 3

    So we're in View Controller 3 and by tapping on the same tab (Tab 1) again, I will now take back to View Controller 1 (the first view-controller in navigation controller hierarchy).

    To achieve this, I've made a slight change in on tab tapped closure block:

            hhTabBarView.onTabTapped = { (tabIndex, isSameTab, controller) in
                if isSameTab {
                    if let navcon = controller as? UINavigationController {
                        navcon.popToRootViewController(animated: true)
                    } else if let vc = controller as? UIViewController {
                        vc.navigationController?.popToRootViewController(animated: true)
                    }
                }
                print("Selected Tab Index:\(tabIndex)")
            }
    

    With this, there'll be a possible highlight issue will occurs as part of this change in 2.3.0, to fix this:

    I am suggesting this solution: Integrate this functions in View Controller 1 (and all other where you will have similar navigation flow).

        override func viewWillAppear(_ animated: Bool) {
            super.viewWillAppear(animated)
            // This will be helpful in locking the current tab if we're already in the first view-controller in navigation flow.
            HHTabBarView.shared.lockCurrentTab()
        }
        
        override func viewWillDisappear(_ animated: Bool) {
            super.viewWillDisappear(animated)
            // This will be helpful to unlock the locked tab when we're going forward from the first view-controller in navigation flow.
            HHTabBarView.shared.unlockAllTabs()
        }
    

    P.S. Thanks Nishan for coming up with this issue. πŸ™πŸΌ

    enhancement 
    opened by hemangshah 0
Releases(2.3.0)
Owner
Hemang
iOS Engineer turned to Full Stack
Hemang
πŸ“± TabBar – highly customizable tab bar for your SwiftUI application.

TabBar SwiftUI standard TabView component is not so flexible and to customize it you have to modify appearance proxy of UITabBar or implement your own

Tamerlan Satualdypov 162 Jan 5, 2023
A curved tabbar with a center button

WHTabbar A very simple solution to implement center button in your native UITabbar. Example To run the example project, clone the repo, and run pod in

wajeehulhassan 18 Dec 4, 2022
TabDrawer is a customizable TabBar UI element that allows you to run a block of code upon TabBarItem selection

TabDrawer TabDrawer is a customizable TabBar UI element that allows you to run a block of code upon TabBarItem selection, or display a customizable dr

Winslow DiBona 503 Oct 5, 2022
Customisable iOS bottom menu works like Tabbar

SSCustomTabMenu Simple customizable iOS bottom menu works like Tabbar, in Swift. Features Simple and customizable iOS Tab Menu items, in Swift. Requir

Simform Solutions 81 Aug 3, 2022
Full Customizable Tabbar with IBInspectables

BEKCurveTabbar Full Customizable Tabbar with IBInspectables A fun replacement for UITabbar. The Component uses BΓ©zier paths. Demo Example usage: You c

Behrad Kazemi 169 Dec 5, 2022
CustomUI in SwiftUI - Full Native Custom SwiftUI NavBar, TabBar, SearchBar, Dark mode, a little bit animations

CustomUI_in_SwiftUI Full Native Custom SwiftUI NavBar, TabBar, SearchBar, Dark m

Alexander Ryakhin 1 Jun 5, 2022
CustomTabBar - A Custom TabBar Built Using Swift

CustomTabBar Thanks to Riccardo Cipolleschi for his awesome tutorial. The TabBar

SM Arif Ahmed 1 Feb 14, 2022
A fully customizable container view controller to display a set of ViewControllers in a horizontal scroll view. Written in Swift.

DTPagerController This is a control for iOS written in Swift. DTPagerController is simple to use and easy to customize. Screenshots Default segmented

Tung Vo 290 Nov 13, 2022
Paging view controller and scroll tab view

TabPageViewController Description TabPageViewController is paging view controller and scroll tab view. Screenshot Infinity Mode Limited Mode Customiza

M 1.3k Jan 7, 2023
ℒ️ A powerful paging view controller with interactive indicator bars

⭐️ Features Easy to implement page view controller with interactive indicator bars. Highly adaptable and powerful customization. Fully extensible with

UI At Six 2.5k Jan 2, 2023
Pager is the simplest and best way to implement sliding view controllers in Swift

Pager is the simplest and best way to implement sliding view controllers. Installation Drop in the Spring folder to your Xcode project. Or via CocoaPo

Lucas Oceano 234 Aug 5, 2022
Pop-up based view(e.g. alert sheet), can be easily customized.

MMPopupView 中文介绍 A basic Pop-Up Kit allows you to easily create Pop-Up view. You can focus on the only view you want to show. Besides, it comes with 2

ralph li 2.1k Jan 3, 2023
PrettyBorder is a SwiftUI package for managing an customized border and background at any kind of view.

PrettyBorder Description PrettyBorder is a SwiftUI package for managing an customized border and background at any kind of view. Preview of end result

Ahmet Giray Uçar 2 Oct 13, 2021
Design and prototype customized UI, interaction, navigation, transition and animation for App Store ready Apps in Interface Builder with IBAnimatable.

Design and prototype customized UI, interaction, navigation, transition and animation for App Store ready Apps in Interface Builder with IBAnimatable.

IBAnimatable 8.6k Jan 2, 2023
NextLevel is a Swift camera system designed for easy integration, customized media capture, and image streaming in iOS

NextLevel is a Swift camera system designed for easy integration, customized media capture, and image streaming in iOS. Integration can optionally leverage AVFoundation or ARKit.

NextLevel 2k Jan 2, 2023
JDSwiftMap is an IOS Native MapKit Library. You can easily make a highly customized HeatMap.

JDSwiftMap is an IOS Native MapKit Library. You can easily make a highly customized HeatMap. Installation Cocoapods pod 'JDSWiftHeatMap' Usage JDSwi

郭介騡 135 Dec 26, 2022
[iOS] Add customized buttons and toolbars to your UITextInputs.

RFKeyboardToolbar This is a flexible UIView and UIButton subclass to add customized buttons and toolbars to your UITextFields/UITextViews. This projec

Rudd Fawcett 421 Oct 30, 2022
PTPopupWebView is a simple and useful WebView for iOS, which can be popup and has many of the customized item.

PTPopupWebView PTPopupWebView is a simple and useful WebView for iOS, which can be popup and has many of the customized item. Requirement iOS 8.0 Inst

Takeshi Watanabe 117 Dec 3, 2022
WWFortuneWheelView - A scroll wheel that can be customized.

WWFortuneWheelView A scroll wheel that can be customized. 一個可δ»₯θ‡ͺθ¨‚ζ•Έι‡ηš„ζ»ΎθΌͺ. Installation with Swift Package Manager dependencies: [ .package(url: "http

William-Weng 1 Jan 6, 2022
SwiftyKeyboard: a full customized numeric keyboard for iOS

SwiftyKeyboard Overview SwiftyKeyboard is an iOS customized enhanced keyboard. T

SwiftyKit 2 Jun 30, 2022