Different Styles of Custom Tab Bar

Overview

LightCardTabBar

An expiremental project exploring different types of custom-tabbar styles, screenshots as below.

Screenshots

Implementation

The implementation relies on two main components: - TabBarController -> which hides the default tabbar and initializes the custom tabbar, and any nesscary components - BaseCardTabBar -> A base class for any client who wishes to implement custom tab bar, including any actions needed.

Examples

The Example Project includes 4 styles of custom-tabbar, crafted and inspired by well made designs.

Each type of tabbar has the two main components, it's own tabbarcontroller and tabbar, all have the same inteface to interact with.

Your own tabbar!

The Example project demonstrates different types of tabbar represents a wide range of applications you can use, I hope the examples provide a starting point if you want to implement your own.

And as always, you can pull request a new style!

License

Copyright 2021 Hussein AlRyalat

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You might also like...
Aesthetic floating tab bar ––– SwiftUI & Combine ⛓️ Importable via Swift Package Manager 📦
Aesthetic floating tab bar ––– SwiftUI & Combine ⛓️ Importable via Swift Package Manager 📦

FloatingTabBar An aesthetic floating tab bar made with SwiftUI & Combine importabable via Swift Package Manager 📦 Based off BottomBar-SwiftUI Preview

A flexible TabBarController with search tab like SNKRS.
A flexible TabBarController with search tab like SNKRS.

PolioPager PolioPager is the easiest way to use PagerTabStrip including search tab in iOS. Written in pure swift. (日本語はこちら) Comparison SNKRS ↓↓↓↓ Poil

Paging view controller and scroll tab view
Paging view controller and scroll tab view

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

iOS Top Tab Navigation
iOS Top Tab Navigation

iOS-Top-Tab-Navigation Good news for all our users out there! Now there are no boundaries to your convenience, you can pass as much words as you want

:octocat: AdaptiveController is a 'Progressive Reduction' Swift UI module for adding custom states to Native or Custom iOS UI elements. Swift UI component by @Ramotion
:octocat: AdaptiveController is a 'Progressive Reduction' Swift UI module for adding custom states to Native or Custom iOS UI elements. Swift UI component by @Ramotion

ADAPTIVE TAB BAR 'Progressive Reduction' module for adding custom states to Native or Custom UI elements. We specialize in the designing and coding of

Custom segmented picker for SwiftUI
Custom segmented picker for SwiftUI

Custom segmented picker for SwiftUI

A custom ViewPager title strip which gives continuous feedback to the user when scrolling
A custom ViewPager title strip which gives continuous feedback to the user when scrolling

SmartTabLayout A custom ViewPager title strip which gives continuous feedback to the user when scrolling. This library has been added some features an

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

CustomTabBar - A Custom TabBar Built Using Swift
CustomTabBar - A Custom TabBar Built Using Swift

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

Comments
  • Bottom Constraint issue

    Bottom Constraint issue

    It seems that hiding the tabBar create side effect with the bottom constraint of the controllers added to the tabBar. Using Snapkit:

    placeholderView.snp.makeConstraints { make in
    	make.top.equalTo(view.safeAreaLayoutGuide).inset(UI.Margins)
    	make.bottom.equalTo(view.safeAreaLayoutGuide).inset(UI.Margins)
    	make.right.left.equalToSuperview()
    }
    

    placeholderView is under the tabBar when it's hidden.

    tabBar.alpha = 0.0
    tabBar.isUserInteractionEnabled = false
    

    these two lines fix the issue

    opened by Bejil 0
  • Appearance Customization

    Appearance Customization

    Hi, it would be great to have some appearance customization options. For now i do it this way in SpecialTabBarController:

    class SpecialTabBarControllerAppearance {
    	
    	public var backgroundColor:UIColor = .white
    	public var indicatorColor:UIColor = .black
    	public var itemsColor:UIColor = .black
    	public var itemsFont:UIFont = .systemFont(ofSize: 14, weight: .bold)
    	public var itemsSelectedColor:UIColor = .lightGray
    	public var itemsSelectedFont:UIFont = .systemFont(ofSize: 14, weight: .bold)
    }
    
    class SpecialTabBarController: TabBarController {
    
    	public static var appearance:SpecialTabBarControllerAppearance = .init()
        
        override func makeTabBar() -> BaseCardTabBar {
            SpecialCardTabBar()
        }
    }
    

    Then, call the properties in the right place in SpecialCardTabBar like this:

    override var preferredBottomBackground: UIColor {
    	SpecialTabBarController.appearance.backgroundColor
    }
    
    opened by Bejil 1
  • Where's the third ViewController in SpecialTabBar ?

    Where's the third ViewController in SpecialTabBar ?

    Hi, thanks for these great tabBars styles. I don't understand why the third viewController in SpecialTabBarController is hidden ?

    I think this could be more flexible...

    One pre version could be to update func set(items: [UITabBarItem]) and func select(at index: Int, animated: Bool, notifyDelegate: Bool) like this:

    override func set(items: [UITabBarItem]) {
    	
    	if items.count < 2 || items.count > 5 {
    
    		fatalError("A Special CardTabBar can't be initialized with less than 2 items and more than 5 items")
    	}
    
    	var mutableItems = items
    	let specialItem = mutableItems.removeLast()
    	let iconOnlyItem = mutableItems.removeLast()
    
    	for i in 0...mutableItems.count-1 {
    
    		let firstTextButton = TextOnlyButton(title: items[i].title)
    		firstTextButton.tag = i
    
    		buttons.append(firstTextButton)
    		self.textCotainerStackView.addingArrangedSubviews {
    			firstTextButton
    		}
    	}
    
    	let withImageButton = IconOnlyButton(image: iconOnlyItem.image, selectedImage: iconOnlyItem.selectedImage)
    	withImageButton.tag = buttons.count
    
    	buttons.append(withImageButton)
    	self.rightButtonsContainerStackView.addingArrangedSubviews {
    		withImageButton
    	}
    
    	let specialButton = SpecialButton(image: specialItem.image, selectedImage: specialItem.selectedImage)
    	specialButton.tag = buttons.count
    	buttons.append(specialButton)
    	self.rightButtonsContainerStackView.addingArrangedSubviews {
    		specialButton
    	}
    
    	buttons.forEach {
    		$0.addTarget(self, action: #selector(buttonTapped(sender:)), for: .touchUpInside)
    	}
    }
    
    override func select(at index: Int, animated: Bool, notifyDelegate: Bool) {
    	guard textCotainerStackView.arrangedSubviews.count > 0,
    		  rightButtonsContainerStackView.arrangedSubviews.count > 0 else {
    		return
    	}
    	
    	self.selectedIndex = index
    	
    	buttons.forEach {
    		$0._isSelected = false
    	}
    	
    	indicatorView.isHidden = buttons[index] is SpecialButton
    	
    	indicatorCenterXConstraint?.isActive = false
    	indicatorCenterXConstraint = indicatorView.centerXAnchor.constraint(equalTo: buttons[index].centerXAnchor)
    	indicatorCenterXConstraint.isActive = true
    	
    	buttons[index]._isSelected = true
    	
    	if animated {
    		UIView.animate(withDuration: 0.3) {
    			self.layoutIfNeeded()
    		}
    	}
    	
    	if notifyDelegate {
    		delegate?.cardTabBar(self, didSelectItemAt: selectedIndex)
    	}
    }
    

    In this way, select method is more dynamic and setItems method too (even if it still forces to have at least the two buttons on the right)

    opened by Bejil 0
Owner
Hussein Ryalat
iOS Designer + Developer
Hussein Ryalat
A prototype of custom tab bar using SwiftUI with techniques of mask + matchedGeometryEffect

SliderTabBar A prototype of custom tab bar using SwiftUI with techniques of mask

Ka Kui 1 Dec 24, 2021
A custom tab bar controller for iOS.

ESTabBarController ESTabBarController is a custom tab bar controller for iOS. It has a tab indicator that moves animated along the bar when switching

null 122 Oct 6, 2022
A custom tab bar controller for iOS written in Swift 4.2

A custom tab bar controller for iOS written in Swift 4.0 Screenshots Installation Cocoa Pods: pod 'AZTabBar' Swift Package Manager: You can use The Sw

Antonio Zaitoun 335 Dec 11, 2022
A fun, easy-to-use tab bar navigation controller for iOS.

CircleBar Don’t you, sometimes, miss fun user interfaces? Truth is, we do. Sure, you can't use them in enterprise apps for obvious reasons, but if you

softhaus 786 Dec 25, 2022
Simplistic & unfinished recreation of MobileSafari's tab bar

SafariTabBar This is a simplistic recreation of the MobileSafari tab bar on iPad (prior to iPadOS 15). It is also very unfinished, and not intended in

Steven Troughton-Smith 51 Oct 26, 2022
📱 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
Aesthetic floating tab bar ––– SwiftUI & Combine ⛓️ Importable via Swift Package Manager 📦

FloatingTabBar An aesthetic floating tab bar made with SwiftUI & Combine importabable via Swift Package Manager ?? Based off BottomBar-SwiftUI Preview

10011.co 135 Jan 8, 2023
Another UITabBar & UITabBarController (iOS Tab Bar) replacement, but uses Auto Layout for arranging it's views hierarchy.

GGTabBar GGTabBar is a simple UITabBar & UITabBarController replacement that uses Auto Layout for constructing the GUI. I created it for curiosity, bu

Nicolas Goles 157 Sep 26, 2022
Emoji Tab Bar button badges ✨

SuperBadges Add emojis and colored dots as badges for your Tab Bar buttons ✨ Usage Add an emoji badge: YourTabBarController.addDotAtTabBarItemIndex(

Oded Harth 55 Dec 13, 2021
📱 A minimal tab bar alternative

MiniTabBar A clean simple alternative to the UITabBar. Only shows the title when being tapped on. Gives the app a way cleaner look :) Requirements iOS

Dylan Marriott 155 Dec 20, 2022