adaptive-tab-bar
: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
Top Related Projects
[In maintenance mode] Modular and customizable Material Design UI components for iOS
Folding Tab Bar and Tab Bar Controller
:octocat: RAMAnimatedTabBarController is a Swift UI module library for adding animation to iOS tabbar items and icons. iOS library made by @Ramotion
:octocat: 📃 FoldingCell is an expanding content cell with animation made by @Ramotion
:octocat: ExpandingCollection is an animated material design UI card peek/pop controller. iOS library made by @Ramotion
Quick Overview
Ramotion/adaptive-tab-bar is an iOS library that provides an animated and customizable tab bar for iOS applications. It offers a unique user experience by adapting the tab bar icons based on the selected state and allows for smooth transitions between tabs.
Pros
- Highly customizable appearance and behavior
- Smooth animations for tab transitions
- Adaptive icons that change based on selection state
- Easy integration with existing iOS projects
Cons
- Limited to iOS platform only
- May require additional setup for complex customizations
- Documentation could be more comprehensive
- Potential performance impact for very complex animations
Code Examples
- Basic setup of AdaptiveController:
let tabBarController = AdaptiveController()
tabBarController.viewControllers = [firstVC, secondVC, thirdVC]
tabBarController.adaptiveTabBarItems = [
AdaptiveTabBarItem(image: UIImage(named: "first")),
AdaptiveTabBarItem(image: UIImage(named: "second")),
AdaptiveTabBarItem(image: UIImage(named: "third"))
]
- Customizing tab bar appearance:
tabBarController.tabBar.tintColor = .blue
tabBarController.tabBar.unselectedItemTintColor = .gray
tabBarController.tabBar.backgroundColor = .white
- Adding a custom animation:
let customAnimation = CABasicAnimation(keyPath: "transform.scale")
customAnimation.fromValue = 1.0
customAnimation.toValue = 1.2
customAnimation.duration = 0.3
tabBarController.setAnimation(customAnimation, forTabAtIndex: 0)
Getting Started
To integrate Adaptive Tab Bar into your iOS project:
-
Add the following to your Podfile:
pod 'AdaptiveTabBar'
-
Run
pod install
in your terminal. -
Import the library in your Swift file:
import AdaptiveTabBar
-
Create an instance of
AdaptiveController
and set it as your root view controller:let tabBarController = AdaptiveController() // Configure view controllers and tab bar items window?.rootViewController = tabBarController
-
Customize the appearance and behavior as needed using the available properties and methods of
AdaptiveController
.
Competitor Comparisons
[In maintenance mode] Modular and customizable Material Design UI components for iOS
Pros of material-components-ios
- Comprehensive library with a wide range of UI components
- Follows Google's Material Design guidelines for consistent look and feel
- Actively maintained with frequent updates and improvements
Cons of material-components-ios
- Larger codebase and potentially higher learning curve
- May require more setup and configuration for individual components
- Less focused on specific tab bar functionality compared to adaptive-tab-bar
Code Comparison
adaptive-tab-bar:
let tabBarItem = ADTabBarItem(
title: "Home",
image: UIImage(named: "home"),
selectedImage: UIImage(named: "home_selected")
)
material-components-ios:
let tabBarItem = MDCTabBarItem(
title: "Home",
image: UIImage(named: "home"),
tag: 0
)
tabBarItem.accessibilityLabel = "Home"
Both libraries provide ways to create custom tab bar items, but material-components-ios offers more extensive customization options and adheres to Material Design principles. adaptive-tab-bar focuses specifically on creating an adaptive tab bar with unique animations, while material-components-ios provides a broader set of UI components for building Material Design-compliant interfaces.
Folding Tab Bar and Tab Bar Controller
Pros of FoldingTabBar.iOS
- More visually appealing with unique folding animation
- Customizable appearance with various color options
- Lightweight and easy to integrate
Cons of FoldingTabBar.iOS
- Less adaptive to user behavior compared to adaptive-tab-bar
- Limited to a specific design style, which may not fit all app aesthetics
- Fewer stars and forks on GitHub, indicating potentially less community support
Code Comparison
FoldingTabBar.iOS:
let tabBarController = YALFoldingTabBarController()
tabBarController.viewControllers = [firstViewController, secondViewController]
tabBarController.leftBarItems = [firstItem, secondItem]
tabBarController.rightBarItems = [thirdItem, fourthItem]
adaptive-tab-bar:
let tabBarController = RAMAnimatedTabBarController()
tabBarController.viewControllers = [firstViewController, secondViewController]
tabBarController.animatedItems.append(RAMAnimatedTabBarItem(title: "First", image: UIImage(named: "first")))
tabBarController.animatedItems.append(RAMAnimatedTabBarItem(title: "Second", image: UIImage(named: "second")))
Both libraries offer easy integration with iOS tab bar controllers, but FoldingTabBar.iOS focuses on a unique folding animation, while adaptive-tab-bar provides more flexibility in terms of adaptive behavior and customization options.
:octocat: RAMAnimatedTabBarController is a Swift UI module library for adding animation to iOS tabbar items and icons. iOS library made by @Ramotion
Pros of animated-tab-bar
- More visually appealing with smooth animations
- Offers a wider variety of customizable animations
- Easier to implement for developers with less experience in custom UI
Cons of animated-tab-bar
- May consume more system resources due to animations
- Less adaptable to user behavior and preferences
- Potentially distracting for users who prefer simpler interfaces
Code Comparison
animated-tab-bar:
let tabBarItem = RAMAnimatedTabBarItem(title: "Home", image: UIImage(named: "Home"), tag: 1)
tabBarItem.animation = RAMBounceAnimation()
adaptive-tab-bar:
let tabBarItem = ADTabBarItem(title: "Home", image: UIImage(named: "Home"), tag: 1)
tabBarItem.adaptiveState = .compact
The animated-tab-bar uses a specific animation class, while adaptive-tab-bar focuses on adaptive states. The adaptive-tab-bar code is slightly more concise and emphasizes adaptability rather than animation.
Both libraries provide enhanced tab bar experiences for iOS applications, but they cater to different preferences. animated-tab-bar is ideal for developers seeking eye-catching animations, while adaptive-tab-bar is better suited for creating user-responsive interfaces that adapt to usage patterns.
:octocat: 📃 FoldingCell is an expanding content cell with animation made by @Ramotion
Pros of folding-cell
- More versatile UI component, applicable to various scenarios beyond tab bars
- Offers a unique and visually appealing expanding cell animation
- Provides more content display options within a compact initial view
Cons of folding-cell
- May require more complex implementation for specific use cases
- Potentially less suitable for navigation-heavy interfaces
- Could be overwhelming if overused in an application
Code Comparison
folding-cell:
let cell = FoldingCell()
cell.itemCount = 2
cell.backgroundColor = .clear
cell.foregroundView = foregroundView
cell.containerView = containerView
adaptive-tab-bar:
let tabBarItem = RAMAnimatedTabBarItem(title: "Home", image: UIImage(named: "Home"), tag: 1)
tabBarItem.animation = RAMBounceAnimation()
tabBarController.setViewControllers([homeVC], animated: true)
tabBarController.setSelectIndex(from: 1, to: 0)
Summary
While adaptive-tab-bar focuses on enhancing tab bar functionality with adaptive icons and animations, folding-cell provides a more flexible expanding cell component. adaptive-tab-bar is better suited for navigation-centric interfaces, whereas folding-cell offers more versatility in content presentation. The choice between the two depends on the specific requirements of your application's user interface and interaction design.
:octocat: ExpandingCollection is an animated material design UI card peek/pop controller. iOS library made by @Ramotion
Pros of expanding-collection
- Offers a unique and visually appealing card expansion animation
- Provides a more immersive user experience for browsing collections
- Includes a customizable layout for expanded cards
Cons of expanding-collection
- May have a steeper learning curve due to its more complex implementation
- Could potentially be less performant with large datasets compared to a simple tab bar
- Might not be suitable for all types of content or app designs
Code Comparison
expanding-collection:
let expandingCollection = ExpandingCollection(collectionViewLayout: CustomLayout())
expandingCollection.itemSize = CGSize(width: 250, height: 350)
expandingCollection.expandedItemSize = CGSize(width: 300, height: 400)
adaptive-tab-bar:
let tabBarController = RAMAnimatedTabBarController()
tabBarController.animationControllerForTransition(from: UIViewController, to: UIViewController)
Summary
expanding-collection offers a more visually striking and immersive user experience, while adaptive-tab-bar provides a simpler and potentially more familiar navigation pattern. The choice between the two depends on the specific needs of the app, target audience, and desired user experience. expanding-collection may be better suited for content-rich apps that benefit from a more engaging browsing experience, while adaptive-tab-bar might be more appropriate for apps requiring quick and straightforward navigation between main sections.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
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 UI for Mobile Apps and Websites.
Stay tuned for the latest updates:
Tab Bar After Install
Tab Bar After Two Weeks
Tab Bar After a Month
Overview
AdaptiveController is module for adding custom states to Native or Custom UI elements. The UI elements evolve over time as the user becomes accustomed to them. An example AdaptiveTabBar is provided.
How to import the control to your project
- First, drag and drop the AdaptiveController project file into your project or select "add existing file" and choose the AdaptiveController project
- Add AdaptiveController to your Target Dependences in the Build Phase of your project.
- Add the AdaptiveController framework in Link Binary With Libraries in Build Phases
- Import AdaptiveController where needed.
Using AdaptiveController
First, you should set the install date, current date, count of days to transition to small text state, and count of days to transition to big image state. The AdaptiveDateState object automatically determines what UI state to show:
var installDate = NSDate(dateString:"2014-09-18")
var adaptiveState = AdaptiveDateState(installDate: installDate, currentDate:NSDate(), countDaysToSmallTextState:countDaysToSmallTextState, countDaysToImageState:countDaysToImageState)
Or count of launches for different state:
var curentCountLaunches = 6
var adaptiveState = AdaptiveLaunchesState(curentCountLaunches:curentCountLaunches, countLaunchesToSmallTextState:5, countLaunchesToImageState:7)
And then you should setup an array of appearances. You should setup button images for each state for each apperance object:
var buttonsAppearances = buttonsAppearancesGenerate() //func butonsAppearancesGenerate() -> [AdaptiveButtonApperance]
And then you should setup an array of items Appearance object. You should set the button's image for each state for each appearance object.
First, you should setup a dictionary for the extension of the image for each UI state:
var imageExtensionsForStates:Dictionary = [ kSmallTitleAdaptiveState:"_smalltitle", kImageAdaptiveState:"_bigimage", kSmallTitleAdaptiveState+selected :"_smalltitle", kImageAdaptiveState+selected:"_bigimage" ]
Then you should set the Appearance for each UITabBarItem title for each state, fonts for each state, a default image if you describe an extension for each state, or if you do not describe an extension, you should setup each image for each state.
First, init the appearance object and setup the text for each state. If the text is the same for each state, you can set text for the default state:
var watchAppearance = AdaptiveButtonAppearance();
watchAppearance.setButonTitle("watch", state: kDefaultAdaptiveState)
watchAppearance.setButonTitle("watch", state: kSmallTitleAdaptiveState)
watchAppearance.setButonTitle("", state: kImageAdaptiveState)
Then you should setup your fonts for each state:
watchAppearance.setButonTitleFontForState(yourDefaultFont, state: kDefaultAdaptiveState)
watchAppearance.setButonTitleFontForState(yourDefaultSmallTitleModeFont, state: kSmallTitleAdaptiveState)
Then you should set the default image and extensions for each state a function which automaticaly sets images for each state:
watchAppearance.setImageNamesForStatesImageExtesions("watch", imageExtensionsForState:imageExtensionsForStates)
Then you should setup the appearance insets for each state:
watchAppearance.setImageInsets(defaultInsets, state: kDefaultAdaptiveState);
watchAppearance.setImageInsets(defaultSmallTitleModeImageInsets, state: kSmallTitleAdaptiveState)
watchAppearance.setTitleOffset(defaultOffset, state: kDefaultAdaptiveState)
watchAppearance.setImageInsets(defaultImageModeInsets, state: kImageAdaptiveState);
Then you should setup Ñustom UITabBarItems which conform to the AdaptiveButtonsProtocol:
var arrayButtons = tabBar.items as [AdaptiveTabBarItem]
In your custom tab item, you should implement these methods from the protocol:
@objc protocol AdaptiveApperanceProtocol {
optional func setFontToAdaptiveButton(font: UIFont)
optional func setTitleToAdaptiveButton(text: NSString)
optional func setImageToAdaptiveButton(image: UIImage?)
optional func setHighlightedToAdaptiveButton(image: UIImage?)
optional func setBackgroundImageToAdaptiveButton(image: UIImage?)
optional func setSelectedImageToAdaptiveButton(image: UIImage?)
optional func setImageInsetsToAdaptiveButton(insets: UIEdgeInsets)
optional func setTitleOffsetToAdaptiveButton(offset: UIOffset)
optional func setTitleColorToAdaptiveButton(titleColor: UIColor)
}
An example implemetation of a protocol method from our custom tab bar item:
func setTitleToAdaptiveButton(text: NSString) {
self.title = text
}
Finally, you should init Adaptive State Manager with the objects you've setup:
AdaptiveButtonsStateManager(state: adaptiveState, buttonsAray:arrayButtons, buttonsAppearance:butonsAppearances)
##Using Custom States For AdaptiveController
Like UITabBar for different custom applications states
We have a default AdaptiveState and with the help of inheritance, we can add new custom states to our state class. The new class in our situation is named AdaptiveDateState
In AdaptiveDateState, we can add new custom states like this:
let kSmallTitleAdaptiveState = "kImageAdaptiveState"
let kImageAdaptiveState = "kNormalImageAdaptiveState"
And add methods which decide how the state relates to input parameters:
var adaptiveState = AdaptiveDateState(installDate: installDate,currentDate:NSDate(),countDaysToSmallTextState:countDaysToSmallTextState,countDaysToImageState:countDaysToImageState)
In AdaptiveDateState, we add custom init methods which decided what states have the Adaptive state object according to the input parameters:
private func stateRemainDays(remainDays:Int, countDaysToSmallTextState:Int, countDaysToImageState:Int)->String {
var mode:String = kDefaultAdaptiveState
print(" DAYS \(remainDays) ")
if remainDays > countDaysToSmallTextState && remainDays < countDaysToImageState{
mode = kSmallTitleAdaptiveState
} else if remainDays > countDaysToImageState {
mode = kImageAdaptiveState
}
print(mode)
return mode
}
You can customize different UI components if they adopt to the AdaptiveApperanceProtocol.
ð License
Adaptive Tab Bar is released under the MIT license. See LICENSE for details.
This library is a part of a selection of our best UI open-source projects.
If you use the open-source library in your project, please make sure to credit and backlink to www.ramotion.com
ð± Get the Showroom App for iOS to give it a try
Try this UI component and more like this in our iOS app. Contact us if interested.
Top Related Projects
[In maintenance mode] Modular and customizable Material Design UI components for iOS
Folding Tab Bar and Tab Bar Controller
:octocat: RAMAnimatedTabBarController is a Swift UI module library for adding animation to iOS tabbar items and icons. iOS library made by @Ramotion
:octocat: 📃 FoldingCell is an expanding content cell with animation made by @Ramotion
:octocat: ExpandingCollection is an animated material design UI card peek/pop controller. iOS library made by @Ramotion
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot